Answer Posted / 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 |
Post New Answer View All Answers
How to Connect to a remote CORBA server?
How to retrieve an InterBase Blob in Delphi using SavetoFile?
Why reusing or inheriting from a Remote Data Module is not a good idea?
How to Use the Application's OnIdle Event?
What is the target load order?
what are the Differences between Create(Self) and Create(Application)?
What is the diff between IT Company & other companies?.
What is a good BDE Alternative?
How to avoid an access violation when using the move procedure?
Explain ODBC Constraints ?
How to change an ISAPI DLL project to a CGI project, or vice-versa?
How to Convert 16bit resource to 32bit?
How to create a bitmap from an icon?
How to Get a handle on your files ?
How to Access Server Methods from Client ?