function GetComputerNameStr : string; var Buffer : array[0..MAX_COMPUTERNAME_LENGTH - 1] of Char; Len : DWord; begin Len:=SizeOf(Buffer); if GetComputerName(@Buffer, Len) then Result:=string(Buffer) else Result:=''; end;
function GetComputerNameEx(NameType: COMPUTER_NAME_FORMAT; lpBuffer: LPSTR; var nSize: DWORD): BOOL; stdcall; external kernel32 name 'GetComputerNameExA';
{$R *.DFM}
Function GetFullComputerName: String; var dSize: dword; sResult: string; begin SetLength(sResult, 255); dSize := 255; GetComputerNameEx(ComputerNameDnsFullyQualified,pchar(sResult), dSize); if dSize > 1 then Result := sResult else Result := '(nil)'; end;
procedure TForm1.FormCreate(Sender: TObject); begin Caption := GetFullComputerName; end;
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.