Finding the ID of the user currently logged-in on a Win 95 desktop 
Author Message
 Finding the ID of the user currently logged-in on a Win 95 desktop

I am trying to retreive the ID of the user currently logged-in on a Win95 pc
through my VB 5.0 applications.

When we were running Novell Netware as a server I was able to get at the
bindery information using a third-party product from MicroHelp. Now, we are
switching to NT Server and I need to replace the code that was getting my
this information.

The information I need is stored in the Registry in the
HKEY_LOCAL_MACHINE\Network\Logon\username key but the built-in GetSetting
function only seems to work on the keys located in the HKEY_CURRENT_USER
branch.

Any knows how to get the information I need ???

Thank you,

Jean Paradis



Sun, 07 May 2000 03:00:00 GMT  
 Finding the ID of the user currently logged-in on a Win 95 desktop

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

  That should work in both environments...



Quote:
> I am trying to retreive the ID of the user currently logged-in on a Win95
pc
> through my VB 5.0 applications.



Sun, 07 May 2000 03:00:00 GMT  
 Finding the ID of the user currently logged-in on a Win 95 desktop

Declare Function WNetGetUser& Lib "Mpr" Alias "WNetGetUserA"   (lpName As
Any, ByVal lpUserName$, lpnLength&)

Public Function _GetUserName()
    Dim cbusername As Long, UserName As String, ret As Long
    UserName = Space(256)
    cbusername = Len(UserName)
    ret = WNetGetUser(ByVal 0&, UserName, cbusername)
    GetUserName = IIf(ret = 0, Left(UserName, InStr(UserName, Chr(0)) - 1),
"")
End Function
--
Hope this helps...

Jeffrey Renton
jrenton AT ees DOT enron DOT com



Quote:
> I am trying to retreive the ID of the user currently logged-in on a Win95
pc
> through my VB 5.0 applications.

> When we were running Novell Netware as a server I was able to get at the
> bindery information using a third-party product from MicroHelp. Now, we
are
> switching to NT Server and I need to replace the code that was getting my
> this information.

> The information I need is stored in the Registry in the
> HKEY_LOCAL_MACHINE\Network\Logon\username key but the built-in GetSetting
> function only seems to work on the keys located in the HKEY_CURRENT_USER
> branch.

> Any knows how to get the information I need ???

> Thank you,

> Jean Paradis



Mon, 08 May 2000 03:00:00 GMT  
 Finding the ID of the user currently logged-in on a Win 95 desktop

For a good example of the aforementioned API call, go to Add form and look
at the 'login in dialog' form VB5 supplies as standard. It has all the code
you will need there already.

Paul Stancer

Quote:

>Try using the GetUserName API call
>-andy



Tue, 09 May 2000 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. EASY - Obtaining User ID from Win 3.11/95

2. Preventing a VB app from closing when user logs off in Win '95

3. Finding currently logged in user

4. Finding currently logged in user

5. Finding the workstation name of a currently logged on user

6. Please help Newbie--Shelling Win 95 desktop

7. adding a folder to win 95 desktop

8. Anybody know how to Win 95 Desktop Shortcut?

9. How To Get Desktop Folder Path (Win 95 / NT 4)

10. Win 95 Application Desktop Toolbars in VB??

11. Please help newbie--Shelling Win 95 desktop

12. Refresh the Win 95 desktop

 

 
Powered by phpBB® Forum Software