Solved

GetUserName & GetComputerName Win32 API calls

Posted on 1998-06-30
3
1,343 Views
Last Modified: 2008-02-01
Can someone provide me with the code snippets to call the GetUserName and  GetComputerName Win32 API functions from a Delphi 3.0 project?
0
Comment
Question by:Diver
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 4

Accepted Solution

by:
BoRiS earned 30 total points
ID: 1356655
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
 
LVL 1

Author Comment

by:Diver
ID: 1356656
Oops, forgot to ask you to write the code like a function. I always get an error on the return value.
0
 
LVL 1

Author Comment

by:Diver
ID: 1356657
Just found out that I don't need those Win calls.
Thanks for your help, Boris.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question