Results 1 to 4 of 4

Thread: Need help with VB and WinNT

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2000
    Posts
    79

    Question

    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
    The problem with designing something completely foolproof is to underestimate the ingenuity of a complete fool. - Douglas Adams

    I know the human being and fish can coexist peacefully. - GWB

    I think we agree, the past is over. - GWB

  2. #2
    Addicted Member
    Join Date
    Jan 2000
    Location
    Fresno, California, USA
    Posts
    195
    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

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Sep 2000
    Posts
    79

    Smile 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
    The problem with designing something completely foolproof is to underestimate the ingenuity of a complete fool. - Douglas Adams

    I know the human being and fish can coexist peacefully. - GWB

    I think we agree, the past is over. - GWB

  4. #4
    Addicted Member
    Join Date
    Jan 2000
    Location
    Fresno, California, USA
    Posts
    195
    I believe that this works in '98 also.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width