代码实现如下

procedure TMainForm.tmrMonitorTimer(Sender: TObject);
var
  ComputerName:array[0..MAX_COMPUTERNAME_LENGTH+1] of char; //保留计算机名的缓冲区
  Buffer:Dword; // 缓冲区大小
  sComputerName:string;//计算机名
begin
  Buffer:=MAX_COMPUTERNAME_LENGTH+1;
  if GetComputerName(@ComputerName,Buffer)   then
    begin
      sComputerName:=ComputerName;
    end
  else
    begin
      sComputerName:='';
    end;
  ShowMessage(sComputerName);

end;

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-21
  • 2021-09-17
  • 2022-12-23
  • 2021-10-26
  • 2022-12-23
  • 2021-12-02
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-22
  • 2022-02-10
  • 2022-12-23
  • 2022-12-23
  • 2022-01-03
相关资源
相似解决方案