Solved

GetUserName & GetComputerName Win32 API calls

Posted on 1998-06-30
3
1,338 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

737 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