procedure TForm1.Button1Click(Sender: TObject);
var
leng:integer;
pss:array[0..20] of char;
ss:string;
begin
GetComputername(pss,leng);
ss:=pss;
edit1.text:=ss;
end;
一直按button1,有时候就不对
procedure TForm1.Button1Click(Sender: Tobject);
var
ComputerName: array[0..MAX_COMPUTERNAME_LENGTH+1] of char;
Size: Integer;
begin
Size := MAX_COMPUTERNAME_LENGTH+1;
if GetComputerName(ComputerName, Size) then
Edit1.Text := StrPas(Computername)
else
Showmessage('Computer Name Not Found');
end;