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

what are the different String Trim functions?

0 Answers  


How to Get the actual size of a TComboBox?

0 Answers  


How to Get a list of the available drives on a system?

0 Answers  


How to obtain IDAPI32.LIB and IDAPI.H ?

0 Answers  


Are there any tools to help me migrate my applications to Delphi?

0 Answers  


How to Connect via ODBC using Delphi or C++ Builder ?

0 Answers  


what is Client launching ?

0 Answers  


How to Hide the application from the Windows Taskbar?

0 Answers  


Can we write multi-user database applications in regular Delphi?

0 Answers  


Can ALTER TABLE statment on Paradox tables removes passwords ?

0 Answers  


What are the different ways of defining array sizes?

0 Answers  


How does Delphi's exception handling work?

0 Answers  


Categories