var ComputerBuf: StringBuilder; ComputerBufLen: DWord; begin //Set max size buffer to ensure success ComputerBuf := StringBuilder.Create(MAX_COMPUTERNAME_LENGTH); ComputerBufLen := ComputerBuf.Capacity; if GetComputerName(ComputerBuf, ComputerBufLen) then MessageBox.Show(ComputerBuf.ToString) end;
汗..对一楼的代码有点迷惑.. StringBuilder是什么类型? MessageBox是自已做的类吗? 把一楼的代码改了一下.在Win2000+Delphi7下测试通过..var ComputerBuf:array[0..127] of Char; ComputerBufLen: DWord; begin ComputerBufLen:=128; GetComputerName(ComputerBuf ,ComputerBufLen) ; Showmessage(ComputerBuf); end;
ComputerBuf: StringBuilder;
ComputerBufLen: DWord;
begin
//Set max size buffer to ensure success
ComputerBuf := StringBuilder.Create(MAX_COMPUTERNAME_LENGTH);
ComputerBufLen := ComputerBuf.Capacity;
if GetComputerName(ComputerBuf, ComputerBufLen) then
MessageBox.Show(ComputerBuf.ToString)
end;
StringBuilder是什么类型?
MessageBox是自已做的类吗?
把一楼的代码改了一下.在Win2000+Delphi7下测试通过..var
ComputerBuf:array[0..127] of Char;
ComputerBufLen: DWord;
begin
ComputerBufLen:=128;
GetComputerName(ComputerBuf ,ComputerBufLen) ;
Showmessage(ComputerBuf);
end;