How to get currently logged in username?
How do you get the currently logged in username in a Firemonkey Delphi project? I'm targeting both Windows and Mac. I have XE2, but I suppose any version solution is fine because I will upgrade if needed. RRUZ For Windows you can use the GetUserName WinAPi function, for OSX you can use the NSUserName and/or NSFullUserName methods. Try this sample for OSX {$APPTYPE CONSOLE} {$R *.res} uses Macapi.CoreFoundation, Macapi.Foundation, System.SysUtils; function NSUserName: Pointer; cdecl; external '/System/Library/Frameworks/Foundation.framework/Foundation' name _PU +'NSUserName'; function