Advertisement

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

7_2009-2012 #217261
Converting long file names

VB4's commands for dealing with file names (such as KILL, MKDIR, and FILECOPY) support long file names without programmer interaction. A number of the Win95 API functions will return only the short name, and you'll notice a number of short file name entries if you're digging through the registration database. Therefore, occasionally you'll need to convert a short file name into a long file name. This function lets you pass a long file name with no ill effects. The file must exist for the conversion to succeed. Because this routine uses Dir$ and "walks" the path name to do its work, it will not impress you with its speed:

7_2009-2012 #217270
16 and 32 bit functions to create

16 AND 32 bit functions to read/write ini files--very useful!

7_2009-2012 #217291
.INI read/write routines

.INI read/write routines mfncGetFromIni-- Reads from an *.INI file strFileName (full path & file name) mfncWriteIni--Writes to an *.INI file called strFileName (full path & file name) sitush@aol.com

7_2009-2012 #217296
cIniFile

Complete access to INI files through a simple class module, which works with VB4 16,32 and VB5. This class module allows you to read/write INI values, delete values, delete sections and query whole sections through a simple inteface.

7_2009-2012 #217309
Win95DirectoryPrompt

Prompting the User for a Directory in Win95. Windows' common dialogs are great if you want the user to select a file, but what if you want them to select a directory? Call the following function, which relies on Win32's new SHBrowseForFolder function:

7_2009-2012 #217322
How to open a file with one line of code!

You create a funtion that can open a file with just one line of code.

7_2009-2012 #217323
File/Directory/Drive Exists (Updated)

This code returns a true/false if a specified drive/directory/pathname exists. This is a small, fast routine.

7_2009-2012 #217324
GetShortFileName

A short pathname of the passed string containing a long pathname. 'For example it turns "C:\Windows\MY Long Path Name\My Long Name File.txt" into "c:\windows\mylong~1\mylong~1.txt" (The actual resulting pathname is determined by the short names that windows assigns to all files and directories). 'This is useful when you need to create a fail proof pathname (assuming the file exists and is accesible).

7_2009-2012 #217337
Raw Disk Access

RDA makes direct, low-level, byte-precise reads and writes to mass-storage devices easy. No need to have to deal with DOS interrupt calls or any such nonsense - RDA takes care of all the behind-the-scenes work for you. RDA also handles the variations in access methods needed by different Windows versions. RDA can read from or write to any specific sector on a logical drive. And if that's not easy enough, there's even a nonvisual frontend component that makes RDA appallingly easy to use - pick drive/first sector/how many sectors to read, call one procedure to perform the actual read, read data from a property. RDA is based on and inspired by a Delphi unit file called VWIN32, written by Geir Wikran, and incorporates portions of VWIN32 directly. As such, RDA is released under the same licensing terms as VWIN32 - free for personal or commercial use as long as the source itself is never sold or misrepresented. PLEASE NOTE: The RDA distribution includes a demo application which requires the TMPHexEditor/TMPHexEditorEx components package by Markus Stephany. This package is available from http://www.mirkes.de/en/delphi/vcls/hexedit.php.

7_2009-2012 #217340
RmDir

This Procedure Deletes all Files in Directory as well as all Sub Directories and Files

7_2009-2012 #217343
ShellExec, Wait and Check for changes for a file.

This sample program calls the Windows API to ShellExecute to a file you select. Then it opens the file with it's associated program, waits for the program to end, and identifies if the file has been changed. Rock ON!

7_2009-2012 #217349
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$.

7_2009-2012 #217360
FilesSearch

This sub/function searches your hard drive(s) or directories for file(s) like the Windows 'Find Files or Folders...'. It uses mainly the Dir() command and can be used with any programs and visual basic I have encountered. This helps uses to quickly find a file or program for their applications.

7_2009-2012 #217386
File Loading Methods Compared

This example compares four file loading methods, (the normal VB Open method, the ReadFile API, and other methods involving MemCopy API), you will also see the difference between returning a String or a Byte Array. I did this example because I keep seeing people using the normal VB Open command to load files, even for Hex editors, as you will see there's a huge difference between using it and using an API. The test in the screen shot was made with a 1GHZ P3 Notebook with 384MB RAM (as a compiled .EXE), please note that times may vary from test to test depending on what your computer's doing, etc. Comments and/or improvements as well as votes are welcome.

7_2009-2012 #217409
Open Folders As Windows from VB5

This code is for those people who want to open up folders/directories as separate windows, as compared to the alternative fileboxes.

7_2009-2012 #217425
Command1_click

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

7_2009-2012 #217426
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

7_2009-2012 #217444
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.

7_2009-2012 #217463
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).

7_2009-2012 #217464
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.

Languages
Top Categories
Global Discovery