Declare Function GetSystemDirectory Lib "kernel32.dll" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Platforms: Win 32s, Win 95/98, Win NT
GetSystemDirectory reads the path of Windows's System directory. This is where many important files for Windows are stored, including the API DLLs. Never assume this is "C:\Windows\System" because the Windows directory doesn't have to be called Windows. The path of the system directory is put into the string variable passed as lpBuffer. The function returns the length of the string returned if it is successful, or 0 if it failed.
Example:
' Display the path of the system directory
Dim sysdir As String ' receives path of system directory
Dim slength As Long ' receives length of returned string
sysdir = Space(255) ' make room in the buffer to receive the string
slength = GetSystemDirectory(sysdir, 255) ' determine the system directory's path
sysdir = Left(sysdir, slength) ' extract the returned string from the buffer
Debug.Print "System directory path: "; sysdir
See Also: GetWindowsDirectory
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/getsystemdirectory.html