Who Am I Program in VB 
Author Message
 Who Am I Program in VB

Does anyone know how I can get the username on a Win 95 network? The NET
CONFIG command will give it, but I'm looking for something more elegant.

Win 95 Clients, NT server.



Tue, 03 Oct 2000 03:00:00 GMT  
 Who Am I Program in VB


Quote:
>Does anyone know how I can get the username on a Win 95 network? The NET
>CONFIG command will give it, but I'm looking for something more elegant.

>Win 95 Clients, NT server.

for a simple way, run net config, but capture the contents of the output
to a temporary file like thus...

Shell("net config > temp.txt")

then open temp.txt and read in whatever the output is, and use that.

i'm certain there is a better method, but i confess i haven't got a clue
about it.

--
SUNIL RAO **************** "oru whisky, oru masala dosa... MIND IT!!!!"


                                        COOL sigarette::~



Tue, 03 Oct 2000 03:00:00 GMT  
 Who Am I Program in VB

Try this.

    Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA"
(ByVal lpbuffer as String, nSize as Long) As Long

Function GetLoginName() As String

    Dim sBuffer as String
    Dim lSize as Long

    sBuffer = Space$(255)
    lSize = Len(sBuffer)

    Call GetUserName(sBuffer, lSize)
    If lSize > 0 Then
        GetLoginName = Left$(sBuffer, lSize)
    Else
        GetLoginName = vbNullString
    End If

End Function

This will return the user name of the person logged in to the computer.  If
it can not determine the user name, the function will return a null string.

Hope this helps!

William J. Steele

To send me real e-mail, remove the "_nospam" from my e-mail address above.

Quote:

>Does anyone know how I can get the username on a Win 95 network? The NET
>CONFIG command will give it, but I'm looking for something more elegant.

>Win 95 Clients, NT server.



Mon, 09 Oct 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. I am learning VB.NET and am wondering....

2. I am looking to hire an expert in Outlook 2000 programming

3. I am using the Compare MS Project COM Program and having issues

4. Am I too stupid to program VBA?

5. Hello, i am new at programming..

6. I am looking for code or program example...

7. I am trying to extract a program path from desktop icon

8. I am trying to extract a program path from desktop icon

9. I am trying to extract a program path from a desktop icon

10. * * * I am Creating an Encryption Program , hobby Crackers needed to test * * *

11. Msg Box help again PLEASE I am new to programming

12. tell another program i am done

 

 
Powered by phpBB® Forum Software