April 21, 2001

GetFileFromCLSID – The file that implements a COM component with given CLSID

‘ Get the name of the DLL or EXE that contains’ the class whose CLSID is passed as an argument” Note: Remote servers aren’t taken into accountFunction GetFileFromCLSID(ByVal clsid As String) As String Const HKEY_CLASSES_ROOT = &H80000000 ‘ try to read the HKEY_CLASSES_ROOTCLSID{…}InProcServer32 value GetFileFromProgID = GetRegistryValue(HKEY_CLASSES_ROOT, _ “CLSID” &

GetFileFromProgID – The file that implements a COM component with given ProgID

‘ Get the name of the DLL or EXE that contains’ the class whose ProgID is passed as an argument” Remote servers aren’t taken into account” NOTE: Requires GetRegistryValueFunction GetFileFromProgID(ByVal ProgID As String) As String Dim clsid As String Const HKEY_CLASSES_ROOT = &H80000000 ‘ get the CLSID from the registry,

ShowSaveFileDialog – Show a Save File common dialog

Private Declare Function GetSaveFileName Lib “comdlg32.dll” Alias _ “GetSaveFileNameA” (pOpenfilename As OpenFilename) As LongPrivate Type OpenFilename lStructSize As Long hwndOwner As Long hInstance As Long lpstrFilter As String lpstrCustomFilter As String nMaxCustFilter As Long iFilterIndex As Long lpstrFile As String nMaxFile As Long lpstrFileTitle As String nMaxFileTitle As Long lpstrInitialDir

IsExecFile – Check whether a file is an executable file

‘check whether the specified file is an executable,’ by checking the last 4 characters.’Example: MsgBox “File is exe: ” & IsExecFile(“C:windows otepad.exe”)Function IsExecFile(ByVal sFileName As String) As Boolean Dim sExt As String On Error Resume Next ‘ first of all, check if the file exists If Not (GetAttr(sFileName) And vbDirectory)

ShowOpenFileDialog – Show a Open File common dialog

Private Declare Function GetOpenFileName Lib “comdlg32.dll” Alias _ “GetOpenFileNameA” (pOpenfilename As OpenFilename) As LongPrivate Type OpenFilename lStructSize As Long hwndOwner As Long hInstance As Long lpstrFilter As String lpstrCustomFilter As String nMaxCustFilter As Long iFilterIndex As Long lpstrFile As String nMaxFile As Long lpstrFileTitle As String nMaxFileTitle As Long lpstrInitialDir

FilesToArray – Read all the files or subdirectories in a directory using API functions

Private Declare Function FindFirstFile Lib “kernel32” Alias “FindFirstFileA” _ (ByVal lpFileName As String, lpFindFileData As WIN32_FIND_DATA) As LongPrivate Declare Function FindNextFile Lib “kernel32” Alias “FindNextFileA” _ (ByVal hFindFile As Long, lpFindFileData As WIN32_FIND_DATA) As LongPrivate Declare Function FindClose Lib “kernel32” (ByVal hFindFile As Long) As _ LongConst MAX_PATH = 260Private