Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Accessing the current user's name!

PaesanoPaesano Member Posts: 8
Is there a way to access the name of the user that is logged on to a machine? It would be amusing to put the fear of God (or whomever) into someone by having a program invoke his or her name while in a runtime environment.
[hr]

Comments

  • didanididani Member Posts: 99
    : Is there a way to access the name of the user that is logged on to a machine? It would be amusing to put the fear of God (or whomever) into someone by having a program invoke his or her name while in a runtime environment.
    : [hr]
    :
    :
    sure... I'm guessing you're running XP for an operating system. Don't. XP has several security countermesures which I, personally, hate. But let's not overreact.
    XP has some neat tricks... it blocks acces to any personal folder that doesn't belong to the logged-in user... so basically, let your little proggie check the "c:documents and settings" folder and acces all the folders in that folder. check for errors... if it didn't find any errors, you know this is the logged in user.
    Or you just make a fake login prompt... More on that in my next post. (Not necessarily XP-Logins....

  • rhboarderrhboarder Member Posts: 105
    : : Is there a way to access the name of the user that is logged on to a machine? It would be amusing to put the fear of God (or whomever) into someone by having a program invoke his or her name while in a runtime environment.
    : : [hr]
    : :
    : :
    : sure... I'm guessing you're running XP for an operating system. Don't. XP has several security countermesures which I, personally, hate. But let's not overreact.
    : XP has some neat tricks... it blocks acces to any personal folder that doesn't belong to the logged-in user... so basically, let your little proggie check the "c:documents and settings" folder and acces all the folders in that folder. check for errors... if it didn't find any errors, you know this is the logged in user.
    : Or you just make a fake login prompt... More on that in my next post. (Not necessarily XP-Logins....
    :
    :
    put a winsock control on your form, for coding put:
    [code]
    dim strName as String
    strName = winsock1.localhostname
    [/code]

  • lavey666uklavey666uk Member Posts: 9
    to retrieve the network logon use this api (dump in a module and call fOSUserName()):

    [code]
    Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
    "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long

    Function fOSUserName() As String
    ' Returns the network login name
    Dim lngLen As Long, lngX As Long
    Dim strUserName As String

    strUserName = String$(254, 0)
    lngLen = 255
    lngX = apiGetUserName(strUserName, lngLen)
    If (lngX > 0) Then
    fOSUserName = Left$(strUserName, lngLen - 1)
    Else
    fOSUserName = vbNullString
    End If

    End Function

    [/code]
Sign In or Register to comment.