-
I'm in the middle of doing a simple Blackboard/Message board system for use in work. It's pretty much done apart from the final part that the bosses want done which involves creating a log file stating who read the messages including date and time. The date and time is easy enough but I'm not sure how to identify who's read the message. The only way that I can think of is to use everyones WinNT Logon, but I'm not quite sure how to do this.
So basically what I want to do is creat a text log file in the following format:
"(User) read the message at (Time)(date)"
Any help or suggestions on how I can do this would be appreciated.
Cheers
-
You have to use the API.
Private Declare Function win32_nlWNetGetUserA Lib "mpr.dll" Alias "WNetGetUserA" (ByVal lpName As String, ByVal lpUserName As String, lpnLength As Long) As Long
Public Function duwinsys_sWNetGetUser() As String
'Retrieve the logged-in username.
Dim nPos As Integer
Dim nlBufLength As Long
Dim sUserId As String
sBuf As String
sUserId = ""
sBuf = Space$(256)
nlBufLength = Len(sBuf)
If win32_nlWNetGetUserA("", sBuf, nlBufLength) = 0 Then
nPos = InStr(sBuf, Chr$(0))
If nPos > 0 Then
sUserId = Left$(sBuf, nPos - 1)
Else
sUserId = sBuf
End If
End If
duwinsys_sWNetGetUser = sUserId
End Function
-
Thanks very much!!
Cheers HDR, I'll give that a go.
I hate to be a nuisance but I don't suppose there's away to do this Win 98 also, cos I just been told that there are a few Win98 machines in here also.
Cheers
-
I believe that this works in '98 also.