Private Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long

Private Sub Command1_Click()
Dim strSysDir As String
Dim Temp As String
strSysDir = Space(144)
GetSystemDirectory strSysDir, 144
MsgBox strSysDir & "\blah.txt"
End Sub


Run that code and you will notice no matter what you do the strSysDir will not combine with the blah.txt and I cant figure out why not!! Maybe a Vb bug or something but what I want is c:\windows\blah.txt or if your in nt I want it to display c:\winnt\blah.txt or if you have a differently named windows directory and so on.

I found a solution...It has a trailing null character I had to trim off..But using replace crashed vb so I trimmed it off manually...