Here's how I get the Currently logged-on Username. As for the other, that
someone else will need to help you with!
////////////// Code begins /////////////////////////////////////////
I place this in my mainform's OnCreate:
Var
Count : DWORD;
UserName : Pchar;
Begin
Username := '';
Count := 0; //DWORD
Try
GetUserName(UserName, Count); //username is Pchar
UserName := StrAlloc(Count);
If GetUserName(UserName, Count) Then
Begin
AppUserName := StrPas(UserName);
End;
Finally
StrDispose(UserName); //free object
End; //finally
End;
///////////// Code Ends ////////////////////////////////////////////
>From "Robert Meek"
Personal e-mail: [EMAIL PROTECTED]
dba / "Tangentals Design"
Visit us at: www.TangentalsDesign.com
Home of "The Keep"!
Member of: "Association of Shareware Professionals"
Moderator for: "The Delphi", "Delphi-DB", and "Delphi-Talk" programming
lists at elists.org,
and proud to be a donator to the Jedi VCL 3.0.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of [EMAIL PROTECTED]
Sent: Wednesday, April 13, 2005 12:10 PM
To: [email protected]
Subject: Current user name and user group/account
Request:
Information on how to obtain current user name and the users "group" or
"account" name. Code snippet appreciated.
Reason:
Looking to use the accepted Windows login by reading the user name and
the users "group" or "account" name. This way my program can make an
association between the Windows "group" or "account" and my internal
security group, hence bypassing a secondary login. This also gives the
system administrator an easier way to maintain security in one place.
Bjarne \v/
__________________________________________________
Delphi-Talk mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi-talk
__________________________________________________
Delphi-Talk mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi-talk