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 set the Wallpaper on Windows98/2000 when ActiveDesktop is turned on?
How to use the Lookup method to return values from multiple columns ?
I just bought Delphi. Where are the language and library reference manuals?
How to tell if a form has been created (or any object)?
Why won't the virtual key codes work in program?
How to Hide the application from the Windows Taskbar?
what are the Current MSACCESS driver limitations ?
What does memory leak show in delphi?
How to create Interbase stored procedures that return parameters with TIBQuery?
How to Access a grid's column or row by name ?
what are the different Dataset event handlers?
How to Change the owner of a component at runtime ?