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 Access new interfaces in a RemoteDataModule?
How to Get bin names from your printer?
How to Converta RGB color to a CMYK color?
How to get the default Windows folders ?
How to prevent the user from moving or sizing my form?
How to use return instead of tab or mouse to move off a control ?
How to Generate a Windows Console Application?
How to Avoid an Application Error when using EM_POSFROMCHAR ?
How do we get access to a database from Delphi?
How to set the desktop icon color in code, or make the text behind them transparent?
How to Determine minor version number?
How to Move a form by clicking in its client area ?