Make your own free website on

Get Windows Directory

'Add a module to your project (In the menu choose Project -> Add Module, Then click Open)
'Insert the following code to your module:

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

'Insert the following code to your form:

Private Sub Form_Load()
Dim Junk, WinDir$
WinDir = Space(144)
Junk = GetWindowsDirectory(WinDir, 144)
WinDir = Trim(WinDir)
MsgBox "The Windows Directory Path is: " & WinDir
End Sub

Go Back