Returns the full path of the Windows directory.
- Syntax
-
Path = WinDir()
Source
#If Win32 Then ' 32-bit VB uses this Declare.
Declare Function GeneralWinDirApi Lib "kernel32" _
Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, _
ByVal nSize As Long) As Long
#Else ' 16-bit VB uses this Declare.
Declare Function GeneralWinDirApi Lib "Kernel" _
Alias "GetWindowsDirectory" (ByVal lpBuffer As String, _
ByVal nSize As Integer) As Integer
#End If
Function WinDir() As String
Const FIX_LENGTH% = 4096
Dim Length As Integer
Dim Buffer As String * FIX_LENGTH
Length = GeneralWinDirApi(Buffer, FIX_LENGTH - 1)
WinDir = Left$(Buffer, Length)
End Function
|