VB 6.0 - File System, IO & Registry Samples
Register and Unregister ActiveX Components
Register and unregister ActiveX DLLs and OCXs from VB without running
Regsvr32.exe.
Touch Files
Set file creation, modified and last accessed dates.
Windows-Like File Operations
Copy, move, rename and delete files and folders or send them to the Recycle Bin
displaying the same dialog boxes, status and confirmation messages, and
progress indicators as Windows.
Using the Scripting Runtime Engine's FileSystemObject
The Scripting Runtime Engine (Scrrun.dll) FileSystemObject
simplifies file operations like copying, moving and deleting files and folders,
querying drive, folder or file information and reading and writing text files.
Get the Paths of the Windows and System Folders
Find the Location of your Executable and
Convert Long Path Names to Short (8 Character) Names
Determine where the Windows and System folders reside. Dynamically find out
where your executable lives. App.Path isn't reliable when your .Exe lives on a
server.
Convert long path names to their equivalent short path names. Example:
C:\Program Files\My becomes C:\Progra~1\Mybrie~.
Get Windows Special Folders Paths
Use the SHGetFolderPath API to get the path to folders such as: Windows,
System, My Documents, My Pictures, Application Data,... This is the
recommended way to find these folders under Windows XP.
Automatically Detect When the Contents of a Folder Change
Have Windows alert your application whenever a folder or any of its sub-folders
change. Changes detected include copying, deleting, renaming files as well as
changing the size or attributes of any files in the folder.
Browse for Files, Folders, Computer and Printers
The SHBrowseForFolder API lets you invoke a system
dialog used to browse for files and folders on your hard drive as well as
network computers and printers.
Registry/Ini File Function Library
This ready to use .Bas module is full of functions to perform common Registry
and/or .Ini file operations such as reading, setting, deleting and enumerating
values and keys. It is self contained and can be included in your application.
Or, use it as a starting point to write your own functions. It illustrates all
the common registry and .Ini API functions.
Registry Operations Simplified w/ Windows Scripting Host
The Windows Scripting Host (WSH) trivializes
registry tasks normally requiring much more code. Wshom.ocx
lets you perform basic reading, writing and deleting of
registry values and keys. You can use
the common registry data types and access any part of the registry.
You can also create .VBS files to contain and execute your VB script code
allowing you to create powerful batch files.
Create Desktop Shortcuts, Get Special Folder Locations,
and Refresh the Desktop (Part I)
Create Desktop shortcuts using standard API calls by creating a .Lnk file in
the Recent Files folder then moving it to the Desktop. This
method does not let you set all shortcut properties. Also, see my next two
samples.
Also see how to refresh the desktop and get the location of the Desktop,
Recycle Bin, Control Panel Recent Files and other special folders.
Create Shortcuts (Shell Links) (Part II)
Create shortcuts (shell links - .lnk files) with the iShellLnk
interface and set ALL shortcut properties.
Determine the location of special folders such as the desktop, start menu,
recent files,...
Create Desktop & Internet Shortcuts (Part III)
Here's the easiest way yet to create shortcuts (shell links - .lnk files) and
internet shortcuts. Use the Windows Scripting Host (WSH).
Extract Icons From EXEs and DLLs
View the icons in an .Exe or .Dll and extract them to a PictureBox or other
control with a device context handle (.hdc). You can also draw them to controls
without .hdc's such as an ImageList. This is useful when creating toolbars
where you need to dynamically add icons at run time.
Change the Text and Background Color of Desktop
Icons
Learn about the desktop and how to programmatically customize it. Change the
color of the text and the text's background on your desktop icons.
Replace Files that are Currently In Use
Delete, rename, or move files that are currently being used by the system.
View and Extract the Contents of CAB Files
Programmatically view and extract the contents of cabinet
(.CAB) files with the SetupIterateCabinet
API.
Digitally Sign and Verify Files
Protect files from tampering by digitally signing them. Digitally sign files
with private keys then electronically transmit
them along with the public keys to an associate.
Using the public key your associate can verify the files insuring they were not
tampered with or corrupted during transmission.
Use the Internet Transfer Control to FTP files
The Internet Transfer Control allows you to
FTP files to and from a remote computer. My class module provides
methods to transfer one or more files.
Retrieve File Version Information
Read national language, code page, target OS, version, ... info as well as the
developer's comment, description, copyright and trademark info from EXEs, OCXs,
DLLs, device drivers, and font files.
|