CodeItBetter Programming Another VB Programming Blog

How to return the path to the windows directory.

Posted on January 4, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
'System & API - How to return the path to the windows directory.
Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" _
    (ByVal lpBuffer As String, ByVal nSize As Long) As Long
 
Public Function WindowsDir() As String
    Dim Gwdvar As String, Gwdvar_Length As Integer
    Gwdvar = Space(255)
    Gwdvar_Length = GetWindowsDirectory(Gwdvar, 255)
    WindowsDir = Left(Gwdvar, Gwdvar_Length)
End Function
 
'How can I call this function:
'Debug.Print WindowsDir
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.