GetUserName & GetComputerName Win32 API calls

Can someone provide me with the code snippets to call the GetUserName and  GetComputerName Win32 API functions from a Delphi 3.0 project?
LVL 1
DiverAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
BoRiSConnect With a Mentor Commented:
diver

here is a code snippit for just that...

procedure TForm1.Button1Click(Sender: TObject);
var
 Name: array[0..80] of char;
 Size: Integer;
begin
 Size := 80;
 GetComputerName(Name, Size);//for username change computer for user//
 Showmessage(Name);
end;
0
 
DiverAuthor Commented:
Oops, forgot to ask you to write the code like a function. I always get an error on the return value.
0
 
DiverAuthor Commented:
Just found out that I don't need those Win calls.
Thanks for your help, Boris.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.