Get a current running process 
Author Message
 Get a current running process

HI
How can i get the user name of a current running process in
Windows 2000
i dont need to  know what user is logeed on the computer
i need to know who is the user that run in  the current process

i'll be more than happy for a vb example
thanks alot Guy



Sat, 15 Jan 2005 18:21:48 GMT  
 Get a current running process
Hello,

Thank you for using the Microsoft Newsgroups.

The GetUserName function retrieves the user name of the current thread. Use
the GetUserNameEx function to retrieve the user name in a specified format.

The following is a sample:

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

Private Sub Command1_Click()
    Dim sUserName As String * 255
    Dim lLengthUserName As Long
    lLengthUserName = 255
    sUserName = Space(lLengthUserName)
    lResult = GetUserName(sUserName, lLengthUserName)
    MsgBox sUserName
End Sub

Please feel free to let me know if you have any questions.

Best Regards,  
Kenny Zhou
Microsoft Support

This posting is provided "AS IS" with no warranties, and confers no rights.
Got .Net?  http://www.gotdotnet.com



Mon, 17 Jan 2005 10:39:18 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. How can i get the user name of a current running process

2. Get a current running process

3. How can i get the user name of a current running process

4. How can i get the user name of a current running process

5. Get a current running process

6. Getting all processes running.

7. Getting path of running process

8. Getting running process Ids/killing task under NT

9. Getting running process Ids/killing task under NT

10. Q: Getting calling process from in-process server dll

11. Q: Getting calling process from in-process server dll

12. Q: Getting calling process from in-process server dll

 

 
Powered by phpBB® Forum Software