VB Extension Tools HTML project report
Project: LabledControls Module: MFileSystem

Basic information:

Module Type  Standard module 
File  C:\Code\EE-projects\units\vb\standard\src\FileSystem.bas 
Author  Ralf Kunsmann 
Date  2001 04 30 
Purpose  Several functions concerning file managment. 
Requierements  win.tlb (integrated to the project as reference) 

Procedures:

FormatDrive
SelectFolder95
SelectFolder95Ex
SelectFile
ExistFile
FileAnyDateTime
Win32ToVbTime
GetFullPath
GetFileBase
GetFileBaseExt
GetFileExt
GetFileDir
GetFileDirBase
GetFileDisk
GetFileFullSpec
GetDirExt
CopyAnyFile
MoveAnyFile
VBGetWindowsDirectory
VBGetSystemDirectory
NormalizePath
DeNormalizePath
PathExists
FileToArray
VBGetDiskFreeSpace
EnsureFileIsWriteable
CreateFolderStructure
DeleteAnyFile
GetFileList
GetFileSize
GetSystemDirectory
FileBackup
StringArrayToFile
StringToFile
GetFiles
PathAccessRights
BrowseCallbackProc
GetFunctionAddress


Procedure 'FormatDrive' List of procedures

Scope/Type  Public Sub 
Code parameters  DriveLetter As String
Owner As Form 
Author  Ralf Kunsmann 
Date  2001 05 02 
Purpose  Formating a drive using default Windows dailog. 
In parameters  DriveLetter, Owner (Form) of the dialog. 


Procedure 'SelectFolder95' List of procedures

Scope/Type  Public Function 
Code parameters  StartFolderID As Long
UserMsg As String
Owner As Form
Optional StartFolder As String = "" 
Code return value  String 
Author  Ralf Kunsmann 
Date  2001 04 30 
Purpose  Show OS dialog for folder selection 
Result  String containing selected folder, emty string if cancel was pressed 
In parameters  StartFolderID (Long) - Eine CSIDL_[...] constante;
UserMsg (String) - Advice to the user (is displayed in Dialog);
Owner (Form) - Reference to the calling form. 


Procedure 'SelectFolder95Ex' List of procedures

Scope/Type  Public Function 
Code parameters  StartFolderID As Long
UserMsg As String
OwnerHWnd As Long
Optional StartFolder As String = "" 
Code return value  String 
Author  Ralf Kunsmann 
Date  2001 04 30 
Purpose  Show OS dialog for folder selection 
Result  String containing selected folder, emty string if cancel was pressed 
In parameters  StartFolderID (Long) - Eine CSIDL_[...] constante;
UserMsg (String) - Advice to the user (is displayed in Dialog);
Owner (Form) - Reference to the calling form. 


Procedure 'SelectFile' List of procedures

Scope/Type  Public Function 
Code parameters  InitDir As String
DialogTitle As String
Optional Filter As String = "All Files  
Code return value  String 
Author  Ralf Kunsmann 
Date  2003 09 16 
Purpose  Display a File selection dialog. 
Result  String: Path of the selected file (if selected) 
In parameters  InitDir (String): Intitial folder
DialogTitle (String): Dialog Title
Filter (String): File filter
Flags (Long): Display flags 


Procedure 'ExistFile' List of procedures

Scope/Type  Public Function 
Code parameters  sFile As String 
Code return value  Boolean 
Author  Ralf Kunsmann 
Date  1999 07 03 
Purpose  Check, if a file exists 
Result  True is existing, else False 
In parameters  File path 


Procedure 'FileAnyDateTime' List of procedures

Scope/Type  Public Function 
Code parameters  sPath As String
Optional datCreation As Date
Optional datAccess As Date 
Code return value  Date 
Author  Ralf Kunsmann 
Date  2001 04 30 
Purpose  Get file time stamp 
Result  Time stamp of last writting. 
In parameters  File path. 


Procedure 'Win32ToVbTime' List of procedures

Scope/Type  Public Function 
Code parameters  ft As Currency 
Code return value  Date 
Author  Ralf Kunsmann 
Date  2001 04 30 
Purpose  Convert a time stamp. 
Result  Time stamp as variable of 'date' data type. 
In parameters  Time stamp as variable of 'currency' data type. 


Procedure 'GetFullPath' List of procedures

Scope/Type  Public Function 
Code parameters  sFileName As String
Optional FilePart As Long
Optional ExtPart As Long
Optional DirPart As Long 
Code return value  String 
Author  Ralf Kunsmann 
Date  2001 04 30 
Purpose  Basic version of Win32 API emulation routine. 
Result  Full path name, or an empty string on failure as BSTR, and
indexes to the file name, directory, and extension parts of
the full name. 
In parameters  sFileName - file to be qualified in one of these formats:
    [relpath\]file.ext
    \[path\]file.ext
    .\[path\]file.ext
    d:\[path\]file.ext
    ..\[path\]file.ext
    \\server\machine\[path\]file.ext
iName - variable to receive file name position
iDir - variable to receive directory position
iExt - variable to receive extension position 
Errors  Any of the following:
    ERROR_BUFFER_OVERFLOW      = 111
    ERROR_INVALID_DRIVE        = 15
    ERROR_CALL_NOT_IMPLEMENTED = 120
    ERROR_BAD_PATHNAME         = 161 


Procedure 'GetFileBase' List of procedures

Scope/Type  Public Function 
Code parameters  sFile As String 
Code return value  String 
Author  Ralf Kunsmann 
Date  2001 04 30 
Purpose  Return file name without dive name,  without path,  without
file extension 
Result  File name string 
In parameters  File name string 


Procedure 'GetFileBaseExt' List of procedures

Scope/Type  Public Function 
Code parameters  sFile As String 
Code return value  String 
Author  Ralf Kunsmann 
Date  2001 04 30 
Purpose  Return file name without dive name, without path, with file
extension 
Result  File name string 
In parameters  File name string 


Procedure 'GetFileExt' List of procedures

Scope/Type  Public Function 
Code parameters  sFile As String 
Code return value  String 
Author  Ralf Kunsmann 
Date  2001 04 30 
Purpose  Return file extension only 
Result  File name string 
In parameters  File name string 


Procedure 'GetFileDir' List of procedures

Scope/Type  Public Function 
Code parameters  sFile As String 
Code return value  String 
Author  Ralf Kunsmann 
Date  2001 04 30 
Purpose  Return file drive name and path only 
Result  File name string 
In parameters  File name string 


Procedure 'GetFileDirBase' List of procedures

Scope/Type  Public Function 
Code parameters  sFile As String 
Code return value  String 
Author  Ralf Kunsmann 
Date  2001 04 30 
Purpose  Return file name with dive name, path, name without file
extension 
Result  File name string 
In parameters  File name string 


Procedure 'GetFileDisk' List of procedures

Scope/Type  Public Function 
Code parameters  sFile As String 
Code return value  String 
Author  Ralf Kunsmann 
Date  2001 04 30 
Purpose  Return file drive name only (UNC if given) 
Result  File name string 
In parameters  File name string 


Procedure 'GetFileFullSpec' List of procedures

Scope/Type  Public Function 
Code parameters  sFile As String 
Code return value  String 
Author  Ralf Kunsmann 
Date  2001 04 30 
Purpose  TODO 
Result  File name string 
In parameters  File name string 


Procedure 'GetDirExt' List of procedures

Scope/Type  Private Sub 
Code parameters  sFull As String
iFilePart As Long
iDirPart As Long
iExtPart As Long 


Procedure 'CopyAnyFile' List of procedures

Scope/Type  Public Function 
Code parameters  sSrc As String
sDst As String
Optional Options As Long = 0
Optional Owner As Long = hNull
Optional sProgressTilte As String = "" 
Code return value  Boolean 
Author  Ralf Kunsmann 
Date  1999 11 16 
Purpose  Copy file using OS function (default dialog with progress
bar). 
Result  True on success, else false 
In parameters  1. File, files or folder to be copied (list of files has to
   be null-separated.
2. Flags defining file operation options as defined in
   'EFILEOPS' enumerator.
3. Handle to the owner window.
4. Optional sProgressTilte As String = "". 


Procedure 'MoveAnyFile' List of procedures

Scope/Type  Public Function 
Code parameters  sSrc As String
sDst As String
Optional Options As Long = 0
Optional Owner As Long = hNull
Optional sProgressTilte As String = "" 
Code return value  Boolean 
Author  Ralf Kunsmann 
Date  1999 11 16 
Purpose  Copy file using OS function (default dialog with progress
bar). 
Result  True on success, else false 
In parameters  1. File, files or folder to be copied (list of files has to
   be null-separated.
2. Flags defining file operation options as defined in
   'EFILEOPS' enumerator.
3. Handle to the owner window.
4. Optional sProgressTilte As String = "". 


Procedure 'VBGetWindowsDirectory' List of procedures

Scope/Type  Public Function 
Code return value  String 
Author  Ralf Kunsmann 
Date  2001 04 30 
Purpose  Wrapper to the win API 'GetWindowsDirectory'. 
Result  String containing windows directory. 


Procedure 'VBGetSystemDirectory' List of procedures

Scope/Type  Public Function 
Code return value  String 
Author  Ralf Kunsmann 
Date  2001 04 30 
Purpose  Wrapper to the win API 'GetSystemDirectory'. 
Result  String containing system directory. 


Procedure 'NormalizePath' List of procedures

Scope/Type  Public Function 
Code parameters  sPath As String 
Code return value  String 
Author  Ralf Kunsmann 
Date  2001 05 02 
Purpose  Ensure path is ending to '\'. 
Result  String containing path. 
In parameters  String containing path. 


Procedure 'DeNormalizePath' List of procedures

Scope/Type  Public Function 
Code parameters  sPath As String 
Code return value  String 
Author  Ralf Kunsmann 
Date  2001 05 02 
Purpose  If a path is ending to '\' delete the '\'. 
Result  String containing path. 
In parameters  String containing path. 


Procedure 'PathExists' List of procedures

Scope/Type  Public Function 
Code parameters  sPath As String 
Code return value  Boolean 
Author  Ralf Kunsmann 
Date  2001 05 02 
Purpose  Check if a path exists. 
Result  True if path exists, else False. 
In parameters  String containing path name. 


Procedure 'FileToArray' List of procedures

Scope/Type  Public Sub 
Code parameters  ByVal sFile As String
ByRef sLines 
Code return value  String) 
Author  Ralf Kunsmann 
Date  2000 07 09 
Purpose  Copy contens of a text file to a string array. 
In parameters  String to the file path. 


Procedure 'VBGetDiskFreeSpace' List of procedures

Scope/Type  Public Function 
Code parameters  sDisk As String 
Code return value  Double 
Author  Ralf Kunsmann 
Date  2000 08 16 
Purpose  Get free space on disk. 
Result  Free disk space in byte. 
In parameters  String to disk drive letter. 
Advice  This job can also be done be the Scripting Host 'File System
Object, but: under certain circumstances we get an access
violation or excaption, when ending the app after using the
function. 


Procedure 'EnsureFileIsWriteable' List of procedures

Scope/Type  Public Function 
Code parameters  sFile As String 
Code return value  Boolean 
Author  Ralf Kunsmann 
Date  2001 05 02 
Purpose  Ensure that a file is writable. 
Result  True is file was writable or could be made writable, else False 
In parameters  String containing file path and name. 


Procedure 'CreateFolderStructure' List of procedures

Scope/Type  Public Function 
Code parameters  ByVal sNewFolder As String 
Code return value  Boolean 
Author  Ralf Kunsmann 
Date  2000 08 14 
Purpose  Create a folder structure. 
Result  True, if creating was successful, else False. 
In parameters  String containing folder path. 
Advice  We thought, that the Scripting Hosts FileSystemObject should
be able to do this ... 


Procedure 'DeleteAnyFile' List of procedures

Scope/Type  Public Function 
Code parameters  sSrc As String
Optional Options As Long = 0
Optional hOwner As Long = hNull
Optional sProgressTilte As String = "" 
Code return value  Boolean 
Author  Ralf Kunsmann 
Date  2001 06 23 
Purpose  Deleting a file, files or folder (folder structure) using the
SHFileOperation win API function. 
Result  True on success, else False 
In parameters  1. File, files or folder to be deleted (list of files has to
   be null-separated.
2. Flags defining file operation options as defined in
   'EFILEOPS' enumerator.
3. Handle to the owner window.
4. Title for the progress dialog. 


Procedure 'GetFileList' List of procedures

Scope/Type  Public Function 
Code parameters  Path As String
Files As Collection 
Code return value  Boolean 
Author  Ralf Kunsmann 
Date  2001 11 27 
Purpose  Rekursiv ausgelegt Routine. Erstellt eine Liste aller
Dateien, die in einem Verzeichnis und seinen
Unterverzeichnissen vorhanden sind. 
In parameters  Zeichenkette, die das Verzeichnis angibt. 
Out parameters  Auflistung, an die alle gefundenen Dateien angehängt werden. 
Result  True on Success, else False 


Procedure 'GetFileSize' List of procedures

Scope/Type  Public Function 
Code parameters  psFile As String 
Code return value  Long 
Author  Ralf Kunsmann 
Date  2004 05 06 
Purpose  VB version of GetFileSize. 
Result  Long: The file size in Bytes. 
In parameters  String (psFile): Full path of the regarding file. 


Procedure 'GetSystemDirectory' List of procedures

Scope/Type  Public Function 
Code return value  String 
Author  Ralf Kunsmann 
Date  2004 05 06 
Purpose  VB version of GetSystemDirectory. 
Result  String: The system directory 


Procedure 'FileBackup' List of procedures

Scope/Type  Public Function 
Code parameters  psFileName As String 
Code return value  Boolean 
Author  Ralf Kunsmann 
Date  2005 01 20 
Purpose  Make as Backup copy of a file. 
Result  Boolean: True on success, else False. 
In parameters  String psFileName: Path to the file to be backuped. 


Procedure 'StringArrayToFile' List of procedures

Scope/Type  Public Function 
Code parameters  psFileName As String
psData 
Code return value  String 
Author  Ralf Kunsmann 
Date  2005 01 20 
Purpose  Copy an array of strings (one array item per line) to a file. 
Result  Boolean: True on success, else False. 
In parameters  String psFileName: Path to the output file.
String psData(): The string array, which is to be written. 


Procedure 'StringToFile' List of procedures

Scope/Type  Public Function 
Code parameters  psData As String
psFileName As String 
Code return value  Boolean 
Author  Ralf Kunsmann 
Date  2005 01 24 
Purpose  Copy a string to a file. 
Result  Boolean: True on success, else False. 
In parameters  String psFileName: Path to the output file.
String psData: The string, which is to be written. 


Procedure 'GetFiles' List of procedures

Scope/Type  Public Sub 
Code parameters  Path As String
Optional ScanSubfolders As Boolean = True 
Code return value  Collection 
Author  Ralf Kunsmann 
Date  2003 05 11 
Purpose  Get a list of all files of a folder to a collection.
Handle Sub Folders depending on 'ScanSubfolders' parameter. 


Procedure 'PathAccessRights' List of procedures

Scope/Type  Public Function 
Code parameters  psPath As String 
Code return value  Boolean 
Author  Ralf Kunsmann 
Date  2002 04 18 
Purpose  Check if we have full access rights in certain path. 
Result  Boolean: True if rights are ok, else False. 
In parameters  String: Path to check. 


Procedure 'BrowseCallbackProc' List of procedures

Scope/Type  Public Function 
Code parameters  ByVal hwnd As Long
ByVal uMsg As Long
ByVal lp As Long
ByVal pData As Long 
Code return value  Long 


Procedure 'GetFunctionAddress' List of procedures

Scope/Type  Private Function 
Code parameters  ByVal FunctionAddress As Long 
Code return value  Long 


Reporting date and time: 2009 03 08, 11:50:45 (year month day, hour:minute:second [24 hour format])