Do not use GetSystemDirectory. Use GetSysPath which is exactly the same as GetWinPath except it gets the System directory.
Enjoy!Code:Option Explicit Private Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long Private Const MAX_PATH = 260 Function GetSysPath() As String Dim lPos As Long GetSysPath = String(MAX_PATH, vbNullChar) Call GetSystemDirectory(GetSysPath, MAX_PATH) lPos = InStr(GetSysPath, vbNullChar) If lPos > 0 Then GetSysPath = Left(GetSysPath, lPos - 1) If Not Right(GetSysPath, 1) = "\" Then GetSysPath = GetSysPath & "\" End Function
Cool code sections:
[code]
' My code goes here
[/code]
Result:
Code:' My code goes here





Reply With Quote