请问如何取计算机名??
解决方案 »
- 500分求如何实现在任务栏上显示倒计时代码?
- 刚了解Delphi,请问delphi5的安装步骤是怎样的...急!
- enlib的dbgrid 问题 急~~~~~~
- 请问在Delphi打印时怎样才能在每条记录前加上个行号?
- 请问delphi中能不能这样定义数组属性?
- http://www.truedelphi.com
- Access violation at address 0054B662 in module 'project.exe'.Read of address 00000008
- delphi4、与delphi5或delphi6之间能共存吗?
- 为什么报表不能显示?
- 找错误!谢谢!
- 怎样让鼠标移动到图片的时候,鼠标变成手形的
- 怎样制作控件
size:Cardinal;
begin
GetComputerName(name,size);
ShowMessage(name);
end;
uese ...,winsock;
....
function TDataModel.GetComputername:String;
var
str1,IP,IPStr:String;
Buffer:Array[1..32] of Char;
Host:PHostEnt;
WSData:TWSAData;
begin
WSAstartup(2,WSData); GetHostName(@Buffer[1],32);
str1:=Buffer;
Host:=GetHostByName(PChar(str1));
Result:=Host.h_name; //下面是IP
for i:=1 to 4 do
begin
Ip:=IntToStr(Ord(Host.h_addr^[i-1]));
Ipstr:=Ipstr+Ip;
if i<4 then
Ipstr:=Ipstr+'.'
else
IP:=Ipstr;
end;
end;