Re:How to get a logged on users name to put it into a log file
procedure TForm1.Button1Click(Sender: TObject);
var
MyKey: HKey; {holds a registry key handle}
ValueType: DWORD; {holds the key value type}
MyData: array[0..255] of char; {holds the string from the registry}
dLength: DWORD; {holds the length of the returned
string}
begin {Procedure
Button1Click}
{Open the registry
key}
if RegOpenKeyEx(HKEY_LOCAL_MACHINE,'NETWORK\LOGON',0,0,MyKey) =0 then
begin {if RegOpenKeyEx}
{Retrieve and
display directory information}
dLength := SizeOf(MyData);
RegQueryValueEx(MyKey,'UserName',nil,
@ValueType,@MyData[0],@dLength);
StaticText1.Caption := MyData;
end; {RegOpenkeyEx}
end; {end procedure
Button1Click}
Quote
Christian Bach <acb...@01019frenet.de> wrote in message
news:86f6n1$lf210@bornews.borland.com...
Quote
> How can I get the name of the (windows-)user, that is actually logged on
to
> a machine.
> I need this because I want to handle a logfile, that contains information
> about the users that manipulates data of a paradox-database. My
> paradox-application doesn't ask for a user explicitly.
> thanks for information
> Christian Bach