Uhm...hehe...How the heck do I get my app to recognize which user is logging on??? (in other words: How do I return the username to my app?)
[b][red]Appreciation will be flooded over the one who can help me out[/red][/b] ;-)
[hr]
[b][red][size=4];-)..::Sparky::..;-)[/size][/red][/b]
[hr]
Comments
:
: [b][red]Appreciation will be flooded over the one who can help me out[/red][/b] ;-)
: [hr]
: [b][red][size=4];-)..::Sparky::..;-)[/size][/red][/b]
: [hr]
:
API GetUserName
Need help with it?
: :
: : [b][red]Appreciation will be flooded over the one who can help me out[/red][/b] ;-)
: : [hr]
: : [b][red][size=4];-)..::Sparky::..;-)[/size][/red][/b]
: : [hr]
: :
:
: API GetUserName
:
: Need help with it?
:
Uhm... Yeah (I know practically nothing about API, thanks, man!)
: : :
: : : [b][red]Appreciation will be flooded over the one who can help me out[/red][/b] ;-)
: : : [hr]
: : : [b][red][size=4];-)..::Sparky::..;-)[/size][/red][/b]
: : : [hr]
: : :
: :
: : API GetUserName
: :
: : Need help with it?
: :
: Uhm... Yeah (I know practically nothing about API, thanks, man!)
:
:
if i knew how to make my vb5 work with api's i would like that. but my computer doesn't like api's and always comes up with errors.
Moses 1:39 - "For behold, this is my work and my glory-to bring to pass the immortality and eternal life of man.
-Troy
: : : :
: : : : [b][red]Appreciation will be flooded over the one who can help me out[/red][/b] ;-)
: : : : [hr]
: : : : [b][red][size=4];-)..::Sparky::..;-)[/size][/red][/b]
: : : : [hr]
: : : :
: : :
: : : API GetUserName
: : :
: : : Need help with it?
: : :
: : Uhm... Yeah (I know practically nothing about API, thanks, man!)
: :
: :
:
: if i knew how to make my vb5 work with api's i would like that. but my computer doesn't like api's and always comes up with errors.
:
:
: Moses 1:39 - "For behold, this is my work and my glory-to bring to pass the immortality and eternal life of man.
:
:
: -Troy
:
:
:
:
Then you are probably using them incorrectly. What error do you get?
Place this at the top of a module (form, bas, etc.):
[code]
Public Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
[/code]
If you place it in any place other than a .bas module, you must change Public to Private!
Here's a simple wrapper function to get the username:
[code]
Public Function GetUser() As String
Dim UName As String
Dim x As Long
x = 255
UName = String$(x, 0)
If GetUserName(UName, x) <> 0 Then GetUser = Left$(UName, x - 1)
End Function
[/code]
: : : : :
: : : : : [b][red]Appreciation will be flooded over the one who can help me out[/red][/b] ;-)
: : : : : [hr]
: : : : : [b][red][size=4];-)..::Sparky::..;-)[/size][/red][/b]
: : : : : [hr]
: : : : :
: : : :
: : : : API GetUserName
: : : :
: : : : Need help with it?
: : : :
: : : Uhm... Yeah (I know practically nothing about API, thanks, man!)
: : :
: : :
: :
: : if i knew how to make my vb5 work with api's i would like that. but my computer doesn't like api's and always comes up with errors.
: :
: :
: : Moses 1:39 - "For behold, this is my work and my glory-to bring to pass the immortality and eternal life of man.
: :
: :
: : -Troy
: :
: :
: :
: :
: Then you are probably using them incorrectly. What error do you get?
:
:
: Place this at the top of a module (form, bas, etc.):
: [code]
: Public Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
: [/code]
: If you place it in any place other than a .bas module, you must change Public to Private!
:
: Here's a simple wrapper function to get the username:
: [code]
: Public Function GetUser() As String
:
: Dim UName As String
: Dim x As Long
: x = 255
: UName = String$(x, 0)
: If GetUserName(UName, x) <> 0 Then GetUser = Left$(UName, x - 1)
:
: End Function
: [/code]
:
Hey, thanks, man. I really appreciate that... Now I can get My app done. Besides, I've grown really fond of VB, and I mean REALLY, maybe I'll get an education on it! So, you've helped me on the way, [size=5][red]THANKS[/red][/size]
-Sparky