"The code is exactly
how I would like to write code and the algorithms used are very
efficient and well-documented."
Van T. Dinh, Microsoft MVP
|
|
Module: modAPIFilesAndPaths
Working with drives, paths, and files using the Windows API
|
Procedure Name
|
Type
|
Description
|
|
(Declarations)
|
Declarations
|
Declarations and private variables for the modAPIFilesAndPaths module
|
|
ConvertPathToUNC
|
Procedure
|
Converts the named path to its universal naming convention (UNC) representation.
This function returns the full UNC (Universal Naming Convention) path for the given file system path. For example, assume that your F: drive is mapped to a shared network drive on your server named "dev". The UNC mapping for this would be \\dev\directoryname where directoryname is the name of the directory the drive is mapped to. If you specify a path and a file name and extension for the strFileName argument, the file name and extension are returned along with the UNC path.
If the path you pass is not a mapped network drive, this procedure calls the Windows API to get your computer name. This name becomes the root of the UNC path. For example, if your computer is named "MyComp", and your C drive has the label "MyC", the UNC path would be \\MyComp\MyC.
|
|
DriveFromPath
|
Procedure
|
Returns the drive letter part of the path.
This is a provate helper function that supports other procedures in this module.
|
|
FilesToArrayAPI
|
Procedure
|
Populates the passed array with a list of files in the specified directory.
This search is extremely fast compared to other searches. It is considerably faster than using the Windows Search dialog as well.
|
|
GetFileHandle
|
Procedure
|
Open a file to get a handle to it. We then use this handle for other calls. This function may fail if the file is already opened.
|
|
GetFileSize
|
Procedure
|
Returns the size of the specified file in bytes
|
|
GetFileTime
|
Procedure
|
Returns the specified file time for the specified file.
To specify the type of time you want returned, use the appropriate EnumFileTimeType value.
|
|
GetFileVersion
|
Procedure
|
Returns the version information from a file such as a DLL, EXE, OCX, etc.
|
|
GetLongFileName
|
Procedure
|
Returns the full path and name of a file in long file name format, given a path in DOS compatible short file name format.
|
|
GetShortFileName
|
Procedure
|
Gets the DOS-compatible short file name version of a long file name
|
|
NullTerminatedStringToArray
|
Procedure
|
Converts a null-terminated string to the passed array
|
|
PathFromFullPath
|
Procedure
|
Returns the remainder of a path after the drive letter
|
|
SetFileTime
|
Procedure
|
Sets the specified time on the specified file
|
|
SubDirsToArrayAPI
|
Procedure
|
Populates the passed array with a list of subdirectories in the specified directory
|
|
SystemTimeToVBATime
|
Procedure
|
Converts the Windows SYSTEMTIME struct to a VBA Date type
|
|
VBATimeToFileTime
|
Procedure
|
Converts the passed date value to the Windows FILETIME structure.
When calling the Windows API to work with file times, you must convert to and from VBA Date type serial values and the appropriate Windows time structure. This procedure converts a VBA Date type serial date to the Windows SYSTEMTIME structure.
|
|
VBATimeToSystemTime
|
Procedure
|
Converts the supplied VBA date/time value to the Windows SYSTEMTIME struct
|
|
WinTimeToVBATime
|
Procedure
|
Converts the Windows FILETIME struct to a VBA Date type.
When calling the Windows API to work with file times, you must convert to and from VBA Date type serial values and the appropriate Windows time structure. This procedure converts a Windows FILETIME structure to a VBA-compatible Date type serial date.
|
Overview of Total Visual SourceBook
The source code in Total Visual
SourceBook includes modules and classes for Microsoft Access, Visual
Basic 6 (VB6), and Visual Basic for Applications (VBA) developers. Easily
add this professionally written, tested, and documented royalty-free code
into your applications to simplify your application development efforts.
Additional Resources
|
|