How to display the current user name?
Answer / 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 |
How to capture the URL and title of the current webpage being viewed?
How to Check drive ready status?
How to run executables created in Kylix?
How to Avoid an Application Error when using EM_POSFROMCHAR ?
What is the history of Delphi?
How to Change the owner of a component at runtime ?
Is there a programmatic way to add an alias to the IDAPI.CFG?
How to Convert ASCII files to Paradox tables?
Can we create stored procedures via Delphi or C++ Builder?
How to Limit the amount of text entered in a TEdit?
'Insufficient memory for this operation' error . what does this error mean?
How to detect if a given key was pressed during application during startup?