Solved

GetUserName & GetComputerName Win32 API calls

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi XE2 application frozen on Windows 10 10 312
Print Graphic and Text to Epson TM-T88v 12 259
Delphi Yen format 3 35
update joined tables 2 46
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

810 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