Answer Posted / 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 View All Answers
How to print an HTML document from inside of your application?
'External Exception C0000008' or 'Access Violation' . what does this error mean?
How to use the InterBase API security functions to add, modify and delete users?
How to Pass a function to a procedure or vice versa?
How to run executables created in Kylix?
How to Create a PolyPolygon using a point array?
How to Align maximized forms?
How to Link an animated cursor to a resource file?
How to determine the week number of a given day in the year?
How to create an About Box in Delphi or C++ Builder?
How to Convert from Long to Short file names and paths ?
How to Register a file extension and context menu operations?
What is the equivalent in BCB to a Pdox TCursor?
How to Avoid an Application Error when using EM_POSFROMCHAR ?
What are the reasons involved in using the interface?