Advertisement

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

2002ASP #179
Command1_click

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

2002ASP #180
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

2002ASP #200
Recent Files accessed in a

In a Drop Menu in one of your programs, you can list the last eight files the user opened. This will allow the user to quickly access a recent file again. I literally copied a sample from the VB5.0 package and eliminated the uneeded code.

2002ASP #210
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).

2002ASP #211
FileReader Classes

Two class modules that load any size flat file with delimiters (tab, comma, space, etc.) into memory. Once loaded, you can reference any cell that has been loaded... sort of like Excel.

2002ASP #222
FastTextStream

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

2002ASP #239
Blocked File IO

This code demonstrates the basics behind blocked IO. This is commonly used when copying files.

2002ASP #240
clsScript

This VB Class allows you to quickly and easily read/write files, line by line, word by word.

2002ASP #248
*** 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!

2002ASP #261
Mike's File Merger (Version 2)

BUG: It put a extra byte at the end of the merge due to a mis-calculation, fixed it!! This is Version 2 from my last file merging submission which shelled 'copy' file commands to DOS which merged the files. Well as pathetic as that seemed, i was a lazy programmer and today i rewrote it from scratch to merge the files to one in binary in vb. This application will let you merge any type of file(s), one or more, into one big file. This will work with Almost all audio files (.mp3, .wav) and almost all Video files (.Avi, .Mpeg). Just think, merging all your favorite mp3s into one big file so you don't have to keep making playlists on your audio player and just think if you have a split up DiVX movie and want to put all of the parts together, this will do it. It especially works good on Motion Picture Experts Group (MPEG) formats flawlessly. The only errors I have noticed with merging mp3s together was if one of the mp3s is a bitrate under 100 and another is above 100 the one below becomes distorded. As for mpegs it seems to work perfect on all types. This will also merge .VOB files ripped from your DVD! Please vote for this if you like this or find it useful. -Mike Canejo

2002ASP #262
File Dependency Sniffer v3! [MUST SEE!]

(******Another Big Update, v3 now... I added a 'All Files' (*.*) scan to it so you can see Every File found in an EXE!!! It also sorta the listbox alphabetically! Check It Out!)(*****Updated!!! v2, Calling it v2 cause of the major changes i made to the project including a working filtering scheme that correctly fixes the found filenames correctly as far as i can tell... tell me what u think of this new version!)(****Updated!, Now has a Search Query box feature so you can search for more than one file extention at once! I also included 2 filtering loops to remove bogus findings, but since it is untested fully i left the original project in the zip for you to have regardless... Check it out.)(***Updated, removes dupes now cause some programs have a reoccuring file being found in the search, so i gave the option to remove dupes or not, check screenshot!)(**Updated, I just fixed the VB5 InstrRev part, sorry if it didn't work..)(*Updated, Just added a save feature to it for developers who want to include it in a readme or something, good luck) Description: I needed a file dependency sniffing program really quick for a friend who sent me a Borland exe and needed to know which dlls it needed so I ran to PSC to find my self searching for keywords and not get anything, then I tried one word and kept browsing through the many entries of PSC. Then I came accross one, called nFile_Search, it was so pathetic I could have cried, the only thing i liked was the interface so I kept it for this program, heh, but I cleared the whole form of code and wrote this up and made it so you can search for other types of files besides .dlls, to expand its usability (.ocx, .exe, @ for emails, anything) so enjoy and if anyone out there has tips or ideas to make it more effecient then please submit. Also please vote if it isnt too much trouble ;p IM me at: Mike3dd Email: MikeCanejo@hotmail.com for anything. ;]

2002ASP #268
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').

2002ASP #274
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.

2002ASP #283
KillFiles

I received a request from someone on help with a problem in deleting temporary files. It seems that they needed to delete all temporary files except for those with the current date. This subroutine was the result, and I though it would be good for those of you struggling with how to use the Dir and GetAttr and SetAttr functions in VB

2002ASP #313
Search for file(s) on a Drive with API

My coding actually does several things. The main thing is that it can search an entire Drive and all of its Directories for a file you specify and at the end of the search display the results of it. Or you can do the same thing but this time look for any file with an extention you specify. I made this search for the file using API but I left a function in there you can edit to search for the files without API but it's a little slower and not recommended. This Screen Shot can pretty much explain it all... E-mail: mikecanejo@hotmail.com AIM: Mike3dd

2002ASP #332
Serial Comms with Windows API

When I started with Serial Comms and the API's I tried to find a piece of code as an example... I couldn't , so I wrote my own .. and here it is. Any suggestions to better the code will be great. This little program will open a COM port and read from it as well as write to it. Try this on any serial comm's device like a Modem, barcode scanner, Comm Printer etc.

2002ASP #374
Rename file

This will rename a file in one line of code. Very simple so I do not expect to be voted for but Comments are nice.

2002ASP #419
A huge tip: Visual Basic Scripting Host

This tip is the most powerful bit of code I've ever come across. It will act as an exe but with no need to compile. However you must have either Win 98 or IE5 for it to work

2002ASP #439
Get file info (without API)

Gets the following information from any file: CompanyName FileDescription LegalCopyright ProductName FileVersion ProductVersion InternalName OriginalFilename Basically it's the same information you glean from a file's properties. Uses no API whatsoever. UPDATE 10/26/00 ------------------- Fixes the problem of reading smaller files that don't have the StringFileInfo section padded with null characters. UPDATE 10/30/00 ------------------- OK, now it's perfect. Before it wouldn't find certain characters because some files are ignorant and in turn screwed up the return value but now it's all fine. Use it.

2002ASP #440
Create and save into .txt files.

This will create and write into a *.txt file of your choice. Put this code in a timer and you have yourself a keystroke logger. You can save the contents of a textbox into a file also.

Languages
Top Categories
Global Discovery