Hi,
I'm currently working on a VB application This application will be Shared on a network .Each user on a client once he clicks on the shared application , i want the application to be able to retrieve the current user's id,meaning on every client machine this function will get a differnt user ID since it has a different user logged on the domain
My question is : using API functions can i get the id of the current user on a domain
I'm new to API functions and I want to Know if it will be useful to me.
If any one can recommend a Book on a API it would be kind of you
20-03-2005 at 01:29 PM
|
Goran Level: Moderator Registered: 16-05-2002 Posts: 1681
Re: how to get the current user on a domain
There is a API book by Dan Appleman, I cant remeber of any other...
____________________________
If you find the answer helpful, please mark this topic as solved.
u ca use getcomputername api function
or
shell "net user"
09-08-2005 at 06:32 AM
|
TJ_01 Level: VB Lord Registered: 24-08-2005 Posts: 320
Re: how to get the current user on a domain
Would this code helps?
Declare Function GetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) _
As Long
Private Sub Form_Load()
Dim s As String
Dim cnt As Long
Dim dl As Long
Dim CurUser As String
cnt = 199
s = String$(200, 0)
dl = GetUserName(s, cnt)
If dl <> 0 Then CurUser = Left$(s, cnt) Else CurUser = ""
Label1.Caption = CurUser
End Sub
____________________________
Im JAMES
24-08-2005 at 04:11 AM
|
Asim-GDI GURU Level: Sage Registered: 29-07-2005 Posts: 54
Re: how to get the current user on a domain
Yeah the book by Dan Appleman is the most ideal one to read for beginners.Its called Visual Basic's Programmers Guide to Win32 API.Another book that I think is the masterpiece on WIN32 GDI API is Windows Graphics Programming by Feng Yuan of Hewlett Packard.These are the must books one should have.