This function returns the windows directory path. The function makes use
of the GetWindowsDirectory API function to return to required path. Add the following code
to a FileHandling.bas standard module to compile a File Utility function set:
Private Declare Function GetWindowsDirectory Lib "kernel32" Alias _
"GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize _
As Long) As Long
Function GetWinDir() As String
'*******************************************************
'<DESC> Retrieves Windows Dir Path</DESC>
'<RETURN> Windows Directory Path</RETURN>
'<ACCESS> Public
'<USAGE> strSysPath = GetWinDir()</USAGE>
'*******************************************************
Dim strBuf As String * 256
Dim lngReturn_len As Long
lngReturn_len = GetWindowsDirectory(strBuf, Len(strBuf))
GetWinDir = Trim$(Left$(strBuf, lngReturn_len))
End Function
|