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 |
Can I use DLLs developed in C or C++ from Delphi?
Explain the findnext method?
How to Get the date of a file using Delphi?
How to create an icon from a bitmap?
How to Keep an application in a minimized state?
How to Handle exceptions in Delphi?
How to Convert a TColor value to a HTML Color string ?
How to Debug CORBA clients and servers?
How to Execute a program from my application?
How to Add a document to the Windows 95 Start Button's documents ?
How to detect if a non-menu key has been pressed?
what is rounding?