Declare Function GetWindowsDirectory Lib "kernel32.dll" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Platforms: Win 32s, Win 95/98, Win NT
GetWindowsDirectory reads the path of the Windows directory. This is where Windows itself is stored, along will all of the little applets that come with it. Never assume this is "C:\Windows" because it doesn't necessarily have to be there. The directory is put into the string variable passed as lpBuffer. The function returns the length of the returned string if successful, or 0 if an error occured.
Example:
' Display the location of the Windows directory
Dim windir As String ' receives path of Windows directory
Dim slength As Long ' receives length of the string returned
windir = Space(255) ' initialize buffer to receive the string
slength = GetWindowsDirectory(windir, 255) ' read the path of the Windows directory
windir = Left(windir, slength) ' extract the returned string from the buffer
Debug.Print "The Windows directory is at: "; windir
See Also: GetSystemDirectory
Category: System Information
Go back to the alphabetical Function listing.
Go back to the Reference section index.
This page is copyright © 2000 Paul Kuliniewicz. Copyright Information.
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/g/getwindowsdirectory.html