Показать сообщение отдельно
Старый 22.01.2008, 09:30   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
Malaysia: How to get the PC Name and IP
Источник: http://axmas.blogspot.com/2008/01/ho...me-and-ip.html
==============

static void JobGetServerInfo(Args _args)
{
xSession curXS;
int i;

str GetIP(str Hostname)
{
DLL DLL = new DLL("ws2_32.dll");
DLL DLL2 = new DLL("kernel32");
DLLFunction CopyMemory = new DLLFunction(Dll2, "RtlMoveMemory");
DLLFunction HostInfo = new DLLFunction(DLL, "gethostbyname");
binary Dest = new binary(100);
int Host;
str IP;

HostInfo.arg(ExtTypes::String);
HostInfo.returns(ExtTypes::DWord);
Host = HostInfo.call(Hostname);

CopyMemory.arg(ExtTypes::Pointer,
ExtTypes::DWord,
ExtTypes::DWord);
if(Host)
{
CopyMemory.call(Dest, Host, 16);
if(Dest.dWord(12))
{
CopyMemory.call(Dest, Dest.dWord(12), 4);

if(Dest.dWord(0))
{
CopyMemory.call(Dest, Dest.dWord(0), 4);
IP = int2str(Dest.byte(0)) + "." +
int2str(Dest.byte(1)) + "." +
int2str(Dest.byte(2)) + "." +
int2str(Dest.byte(3));
}
}
}
return IP;
}
;
for(i = 1; i
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.