function GetUserFromWindows: string;
var
UserName : string;
UserNameLen : Dword;
begin
UserNameLen := 255;
SetLength(userName, UserNameLen);
if GetUserName(PChar(UserName), UserNameLen) then
Result := Copy(UserName,1,UserNameLen - 1)
else
Result := 'Unknown';
end;
|