
How can I read out the current installation and WINDOWS\SYSTEM path
App.Path will tell you the directory that your app is run from, or you could
have your setup program write the installation path to the registry.
Use the API to get the Windows directory and System directory:
Declare Function GetWindowsDirectory Lib "kernel32" Alias
"GetWindowsDirectoryA" _
(ByVal lpBuffer As String, ByVal nSize As Long) As Long
Declare Function GetSystemDirectory Lib "kernel32" Alias
"GetSystemDirectoryA" _
(ByVal lpBuffer As String, ByVal nSize As Long) As Long
Public Function GetWinDir() as string
Dim sBuffer as string, lReturnLen as long
sBuffer = string(MAX_PATH, vbNullChar) 'MAX_PATH is 260
lReturnLen = GetWindowsDirectory(sBuffer, Len(sBuffer))
GetWinDir = Left$(sBuffer, lReturnLen) & "\"
End Function
Do the same thing for the system directory but change GetWindowsDirectory to
GetSystemDirectory
Scott Bailey