With the use of CLR interop, there doesn't seem to be a limit to what you can do with Ax. Yes, in the past you could write your own COM wrappers to access those DLL functions. But now, you have much more control. And it's faster. Your basic toolbox just got a LOT bigger. All this .NET components are waiting to be used.
Here's a small example. It demonstrates the well known ping command, to check if a computer is online.
Parameters are the Ip address (string format like 127.0.0.1) and the timeout.
static boolean Ping(str myIpAddressStr,int myTimeOut=4000)
{ System.Net.NetworkInformation.Ping myPing;
System.Net.NetworkInformation.PingReply myPingReply;
System.Net.IPAddress myIPAddress;
System.Net.NetworkInformation.IPStatus myIpStatus;
str myIPStatusStr;
;
if(!myIpAddressStr)
return false;
myIPAddress = System.Net.IPAddress::Parse(myIPAddressStr);
myPing = new System.Net.NetworkInformation.Ping();
myPingReply=myPing.Send(myIPaddress,myTimeOut);
myIpStatus=myPingReply.get_Status();
myIPStatusStr=myIpStatus.ToString();
if(myIPStatusStr=='Success')
return true;
return false;
}
I'll post some more samples later on.
Greetz,
Willy
Friday, June 26, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment