GetWindowsDirectory Function

Declare Function GetWindowsDirectory Lib "kernel32.dll" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long

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, or 0 if an error occured.

lpBuffer
Fixed-length string variable that receives the path.
nSize
The length in characters of lpBuffer.

Example:

' Get the Windows directory
Dim buffer As String * 255
n = GetWindowsDirectory(buffer, 255)
Debug.Print Left(buffer, n)  ' remove empty space

Related Call: GetSystemDirectory
Category: System Information
Back to the index.


Back to Paul Kuliniewicz's Home Page
E-mail: Borg953@aol.com
This page is at http://members.aol.com/Borg953/api/functions/getwindowsdirectory.html