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 Get the time and date in Universal Time ?
'Cannot Load IDAPI Service Library' error. What does this error mean?
How to Detect if the system time has been changed ?
What are Delphi and C++ Builder Action Lists and how to use them?
How much does MTS improve connect times?
How to set the Wallpaper on Windows98/2000 when ActiveDesktop is turned on?
How to set the desktop icon color in code, or make the text behind them transparent?
How to run executables created in Kylix?
How to Hide the windows taskbar?
How to detect the computer name?
Why you want to join IBM only not others like, TCS Infosys, Satyam & Wipro Etc. please do'nt give general answers?.
How to create an executible file using the command line directive in Linux with Kylix?