Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Retrieving user's loginname
Message
 
 
General information
Forum:
Visual Basic
Category:
Other
Miscellaneous
Thread ID:
00239556
Message ID:
00242259
Views:
22
Ed,

are you aware of a book on the Win32 Network API (either by Dan Appleman or someone else), more specifically on the NT networking API's? I've been crawling the web, discovering more search engines that I'd care to, all in vain... It seems either nobody knows these APIs, M$ is keeping them secret or they're taboo (who knows), unless they're just not easily available so that people with mischievous intentions can't get to them easily. Just makes it harder for us with legit intentions to get to them...

Hugo

>>In Visual Fox, the function sys(0) will return the user's logon name. Is there a similar function available in Visual Basic? I hope I don't have to go into Win API just to get the user's name.
>
>The code to get the WIndows login name through the API is pretty trivial in VB:
>
>FromDan Appleman's Book Visual Basic Programmer's Guide to the Win32 API
>
>Declare Function GetUserName& Lib "advapi32.dll' Alias "GetUsernameA" _
>(ByVal lpBuffer As String, nSize as Long)
>DIM S$, cnt&, dl&
>cnt& = 199
>S$ = STRING$(200,0)
>dl& = GetUserName(s$, cnt)
>s$ = Left$(s$,cnt)
>
>Not much more than calling SYS(0) and stripping the machine name if it's present conditionally; it's roughly the same code in VFP using the API, and the API code isn't affected by whether or not you're on a network.
>
>If you don't have Appleman's book, get it - it's probably the most intelligible thing on the Win32 API out now unless you're at least passingly familiar with C/C++.
"My get up and go must've got up and went"
-Steve Tyler, Aerosmith
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform