Cant get LogonUser() to work in VB (Win32 API) 
Author Message
 Cant get LogonUser() to work in VB (Win32 API)

I can't seem to get the Win32 LogonUser() function to work from in VB.  No
matter what I pass it, the return value is always 0.  GetLastError() always
returns 0 as well.  I have given my account "Act as part of the operating
system" privledge... is there anything I might be missing???

Thanks.
Sean Hignett



Tue, 08 May 2001 03:00:00 GMT  
 Cant get LogonUser() to work in VB (Win32 API)
If you're trying to find out the logged on user name, then I believe the API
call you're looking for is "GetUserName"

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

Public Function LogonUser() as String
    dim sBuffer as String * 255
    dim lBufLen as Long
    dim lRet as Long

    lBufLen = 255
    lRet = GetUserName( sBuffer, lBufLen)
    LoginUser = sBuffer

end function


Quote:
>I can't seem to get the Win32 LogonUser() function to work from in VB.  No
>matter what I pass it, the return value is always 0.  GetLastError() always
>returns 0 as well.  I have given my account "Act as part of the operating
>system" privledge... is there anything I might be missing???

>Thanks.
>Sean Hignett




Thu, 10 May 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. LogonUser in Win32 API

2. LogonUser API works for WinNT, but what about Win95

3. LogonUser API works for WinNT, but what about Win95

4. LogonUser API works for WinNT, but what about Win95

5. LogonUser API works for WinNT, but what about Win95

6. VB Win16 API vs Win32 API

7. Calling Win32 API not working

8. How do I use Logonuser API in VB?

9. How do I use Logonuser API in VB?

10. How do I use Logonuser API in VB?

11. Help needed getting the ChooseFont api function to work

12. Getting the Current (working) Directory via Win API

 

 
Powered by phpBB® Forum Software