Posted on 2005-11-14 08:54
貝殼兒 阅读(266)
评论(0) 编辑 收藏 引用 所属分类:
Delphi编程
function GetPCName:AnsiString;
var CNameBuffer:PChar;
fl_loaded:Boolean;
CLen:^DWord;
SResult:AnsiString;
begin
GetMem(CNameBuffer,255);
New(CLen);
CLen^:= 255;
fl_loaded := GetComputerName(CNameBuffer,CLen^);
if fl_loaded then
SResult:= StrPas(CNameBuffer)
else
SResult:= 'Unkown';
FreeMem(CNameBuffer,255);
Dispose(CLen);
Result:=SResult;
end;