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 Use global values in our application ?
How to Print a TStringGrid / TDBGrid?
'External Exception C0000008' or 'Access Violation' . what does this error mean?
How to Change the owner of a component at runtime ?
How to detect the CPU type of the computer the application is running on?
what are Single and multiple application server instances ?
How to set the desktop icon color in code, or make the text behind them transparent?
How to Access new interfaces in a RemoteDataModule?
How to determie if a given machine has a math coprocessor?
Explain about Multi-Threaded ISAPI DLLs ?
How to do a locate on a non-indexed field?
What is the message "Generating font matrix" when starting Kylix?