CodeItBetter Programming Another VB Programming Blog

How to return the path to the system directory.

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

No comments yet.


Leave a comment


 

No trackbacks yet.