Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


How to display the current user name?



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

Post New Answer

More Delphi Interview Questions

How to Get the Printer driver and port name from TPrinter's ?

0 Answers  


How to Use Visual Basic arrays in Delphi ?

0 Answers  


How to Print a web page using the HTML control?

0 Answers  


How to get Table data subset through IProvider ?

0 Answers  


How to get UpdateMode to work for TQuery on a SQL Server 7.0 table?

0 Answers  


How to determie if a given machine has a math coprocessor?

0 Answers  


What are the available Alternate security databases ?

0 Answers  


Do I have to understand object-oriented programming to use Delphi?

0 Answers  


'External Exception C0000008' or 'Access Violation' . what does this error mean?

0 Answers  


Does the BDE use Client side or server side cursors for MSSQL?

0 Answers  


How to Use Stored Procedures ?

0 Answers  


How to display seconds, minutes, tracks of an AVI ?

0 Answers  


Categories