Advertisement

Results for "Category: Files/ File Controls/ Input/ Output"

C_Volume2 #71916
Command1_click

Allows you to backup a source file and have the destination file name be the current date. Great for database backups!

C_Volume2 #71917
Easy routine to check/create directories

This very simple routine avoid checking if a correct path already exist before using it and, if not, create it exactly as you want. Imagine you wont to write a log file in a path defined as: C:\Myapplic\Services\logs\LOG.TXT you must check before if the directory Myapplic exist and then check all other subdirectory (Service,logs) before opening the file For Output. Probably you will use a lot of Error Resume Next, Mkdir(...), Error GoTo 0, dir(....) and so. Instead you can use this routine as described below: Myfile="C:\Myapplic\Services\logs\LOG.TXT" Call CheckDir(Myfile) nf=FreeFile() Open Myfile For Output As #nf . . . Close #nf and including the following .bas module: Public Sub CheckDir(file) Ix = 4 'Initial index KSlash = InStr(1, file, "\", 1) 'Search for first "\" For Cnt = 1 To Len(file) 'Run until discover 'other directories KSlash = InStr((KSlash + 1), file, "\", 1) If KSlash = 0 Then Exit For 'Last slash dir1 = Left(file, (KSlash - 1)) cdir1 = Mid(dir1, Ix) Ix = Ix + Len(cdir1) + 1 hh = Dir(dir1, vbDirectory) 'If Directory doesn't exist, create it If StrComp(hh, cdir1, 1) 0 Then MkDir (dir1) End If Next Cnt End Sub

C_Volume2 #71926
Associate File Name and Icon

For those of you who want to add a touch of professionalism to your program, now you can create a file type in the Windows Registry database which will associate all files ending with your program's file extension ( yourfile.xxx) to your program. You also specify an icon for your file type and a description. This example also shows you how to use Command$ to open these files in your program when once the file is clicked or opened, and a quick tip on creating files in the Windows Recent file folder (Start > Documents).

C_Volume2 #71931
FastTextStream

Read large text files faster. Reads lines in text files about 30% faster then the TextStream class. Skips much faster.

C_Volume2 #71948
FindFile - Fast, using the API

Uses the FindFile, FindNextFile, and SearchPath API functions to quickly find a file on your hard drive. Runs faster than methods which use Dir$.

C_Volume2 #71974
HyperFast! Read/Write File Functions

These two functions are designed to read and write a file as fast as possible in VB. It is faster for some cases than WinApi Read/WriteFile functions because you don't have to convert binary to string in a loop. Thats why, it is very fast and useful for any purpose. I have created it for my Encryption programme and with Windows Crypto functions and this two functions, my encrytion programme works faster than most of the Encrytion software you can download on the net. Hope it will be useful for you. Thanks. Ozan Yasin Dogan www.uni-group.org (will be online in 01/06/02)

C_Volume2 #71977
Embed Binary Files In Programs

Embed binary files within your programs to be written out to the file system once the program runs. This demonstration creates a Word document.

C_Volume2 #72027
Multi File Extantion remover

The program can remove extentions from multipile files, or add them to the files. Prefect if you need to renmae *.--- files or to add --- extention. The code is simple and readable, easy to modify for your own use...

C_Volume2 #72051
Path manipulation

There are many methods you can use to return certain parts of a fully qualified path to a file. Here is the SHORTEST and FASTEST way to 1) return just the path, 2) return just the filename, and 3) change the extension of a filename. The code is so short that it is probably faster to keep it inline than to create additional functions. (I've done so here to better illustrate the parameters.

C_Volume2 #72085
Recurse thru sub directories

I haven't seen this on PSC using the filesystem object or a collection. very neat and fast since you don't need to go through it twice to redim an array. the only slow down with this code is the print statement.

C_Volume2 #72104
Directory and File Search Demo v1.2

Search for a directories, sub-directories and files and sub-files without having objects on your form! You can even search in more directories! or use file-filters (*.bat;*.com;*.exe;ect...) and file-attributes (read only, hidden, ect...) while you search! This all in just one simply command! This version is much easer to use than the preview demo version 1.0. The results in this version also doesn't import duplicated results and some bugs are fixed. The results gives now also the size, date & time, and attributes. In the next version I will add some more commands, like a compleet directory/file browser. It sounds unbelievable but it's true. It's very easy and fast to use and it's over 100% user friendly! No heavy codes anymore just use this for all your codes! Download the file and see it yourself, I know you'll love this code!!!... I will release more codes when you vote for me, happy coding...

C_Volume2 #72152
Execute all files

Normal users use the Shell command, but that command can't execute all kind of files, but this can

C_Volume2 #72176
File System Functions

commonly needed file macros you hate to code over and over. Functions: GetFolderFiles, GetSubfolders, FileExists, FolderExists, SafeFileName, Read/Write/AppendFile, GetFreeFilename, FileNameFromPath,ChangeExtension, etc.. anyway this will help you clean up your code alot and make it more readable Dont forget to check my sight for more stuff: http://geocities.com/dzzie

C_Volume2 #72203
___*Calculate Pi*___

Calculate Pi. This will only let you go to 32763 decimal places. ************************************************* If anyone nows any API for larger math please leave comment about it. *************************************************

C_Volume2 #72242
CheckFileVersion

Retrieve the version of a file (EXE/DLL etc). This code should be paste into a module and just called via CheckFileVersion('Path to the Exe or DLL').

C_Volume2 #72254
*** Destroy a file without getting error! ***

This DOES use the kill function, but when you use this it actually opens the file you want to destroy, cleans it out, then deletes it so you don't get any error because of sensitive data!

C_Volume2 #72266
Open a text file FAST!

Opens a text file much fast than a "Do While Not EOF(filenumber)" loop. Makes file load times almost non-existant.

C_Volume2 #72275
Get the Windows and System directories.

These two functions will return the location of the Windows directory (WinDir) and the location of the System directory (SysDir).

C_Volume2 #72276
Get & set a file's attributes

Sets a file's attributes. With this you can create archive, hidden, normal, read-only, and system files.

C_Volume2 #72280
Input/Output to a text file

This code demonstrate a simple procedure for reading and writing to and from a text file. Level: Beginners

Languages
Top Categories
Global Discovery