Answer Posted / clive
use win32 function getUserName
function MyUserFunction : String;
var
pcUserName : pChar; // temporary storage
dwMaxChars : DWORD; // length parameter
Const
MAXCHARS = 255; // max length
begin
dwMaxChars := MAXCHARS;
pcUserName := strAlloc( MAXCHARS + 1 );
try
If not getUserName( pcUserName, dwMaxChars ) Then
result := ''
else
result := String( pcUserName );
finally
strDispose( pcUserName );
end;
end;
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
How to Get the printing margin of the page?
Where is proxies.dcu?
How to close your application using the Escape key?
How to create an icon from a bitmap?
How to Extract Icons ?
How to Converta RGB color to a CMYK color?
How to Launch default browser on a URL?
How to make the TDateTimePicker display blank?
How to Provide lookup capability?
How to Extract an icon from a .exe or .dll?
How does one change the default directory that Delphi uses to save projects?
How to Detect how many jobs are in the print spooler?
How to Change the default width/height of the editor?
How to Print in Delphi without using the TPrinter Unit ?
How to Display a file's associated icon?