Originally posted by mmccarthy
My second point to the OP was the important part in that post though.
'You must Declare the API Function Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Dim ReturnValue As Long, PathBuffSize As Long Dim PathBuff As String, intOpenFileNumber As Integer PathBuffSize = 255 PathBuff = Space$(PathBuffSize) 'Buffer for Return Value intOpenFileNumber = FreeFile() 'Next available File# 'The Windows System Directory will be returned in PathBuff parameter ReturnValue = GetSystemDirectory(PathBuff, PathBuffSize) 'C++ Strings returned from API calls usually have a Null Terminating Zero at 'the end - it must be removed. Open Left(PathBuff, InStr(PathBuff, Chr(0)) - 1) & "\ODBCLog.txt" For Append As #1 Print #intOpenFileNumber, CurrentUser; " logged off at " & Time() & " on " & Format$(Now(), "ddd, dd/mm/yyyy") Close #intOpenFileNumber
Admin logged on at 7:26:26 PM on Mon, 12/03/2007 Admin logged off at 7:46:51 PM on Mon, 12/03/2007
Comment