[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1358
  • Last Modified:

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?
0
Diver
Asked:
Diver
  • 2
1 Solution
 
BoRiSCommented:
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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now