Question I am writing a program in VB6 where I need to determine the path for the %systemroot%\system32\ folder, and set the value of a string variable to equal this value.
What is the easiest way to do this?
Answer Hi Kevin,
try this -
Private Declare Function GetSystemDirectory Lib "kernel32" Alias _
"GetSystemDirectoryA" (ByVal lpBuffer As String, _
ByVal nSize As Long) As Long
Private Sub Form_Load()
Dim strPath As String, lngRes As Long
strPath = Space(255)
lngRes = GetSystemDirectory(strPath, 255)
sSave = Left$(strPath, lngRes)
MsgBox strPath
End Sub