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 Printer driver and port name from TPrinter's ?
How to Use Visual Basic arrays in Delphi ?
How to Print a web page using the HTML control?
How to get Table data subset through IProvider ?
How to get UpdateMode to work for TQuery on a SQL Server 7.0 table?
How to determie if a given machine has a math coprocessor?
What are the available Alternate security databases ?
Do I have to understand object-oriented programming to use Delphi?
'External Exception C0000008' or 'Access Violation' . what does this error mean?
Does the BDE use Client side or server side cursors for MSSQL?
How to Use Stored Procedures ?
How to display seconds, minutes, tracks of an AVI ?