Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I determine the Computer Name

System Information

How do I determine the Computer Name

by  towerbase  Posted    (Edited  )
I've forgotten where I got this code from but it seems to work okay.
Code:
//------------------------------------------------------------------------------
function ComputerName: string;
//------------------------------------------------------------------------------
var
  ComputerNameLength: DWord;
begin
  ComputerNameLength := MAX_COMPUTERNAME_LENGTH;
  SetLength(Result, MAX_COMPUTERNAME_LENGTH);
  if GetComputerName ( pchar(result), ComputerNameLength ) then
    SetLength ( result, ComputerNameLength )
  else
    result := ''
end;
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top