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 longfilename from a file?

0 Answers  


How to assign a file variable in a Record?

0 Answers  


How to Prevent changing pages in a page control?

0 Answers  


'Translate error, value out of bounds' error what does these errors mean?

0 Answers  


How to Determine if a given printer is capable of printing a PostScript file?

0 Answers  


What does the error 'Token not found'?

0 Answers  


How to Debug an In-Proc COM Server?

0 Answers  


What is "Error 113" during installation?

0 Answers  


How to get serial number of my drive ?

0 Answers  


How to Detect how many jobs are in the print spooler?

0 Answers  


How to install BDE network ?

0 Answers  


How to Disable a radio button in a TRadioGroup?

0 Answers  


Categories