当前位置: 代码迷 >> PB >> pb11.5 发送ICMP报文返回0,解决办法
  详细解决方案

pb11.5 发送ICMP报文返回0,解决办法

热度:106   发布时间:2016-04-29 09:32:03.0
pb11.5 发送ICMP报文返回0,
大家帮我看看。我用的是11.5
ll_RTN = IcmpSendEcho (ll_hICMP, aul_IPAddr, ls_Message, Len(ls_Message), 0, lstr_ICMPReplay, 282, 200)
返回0
但这一段原样不动在pb9里一点事没有。网上说11.5在声明api的时候要加上ansi,不会加。高手帮忙看一下。


local external function 定义如下:
//网际消息协议 (ICMP)函数
FUNCTION Long IcmpCloseHandle (Long IcmpHandle) LIBRARY "icmp.dll"
FUNCTION Long IcmpSendEcho ( Long IcmpHandle, Long DestinationAddress, String requestData, Integer requestSize, Long requestOption, ref icmp_echo_reply replyBuffer, Long replySize, Long timeout ) LIBRARY "icmp.dll" alias for "IcmpSendEcho;Ansi"
FUNCTION Long IcmpCreateFile() LIBRARY "icmp.dll"

//WinSock函数
FUNCTION Long WSAStartup( uInt wVersionRequested, REF WSADATA lpWSAData ) LIBRARY "wsock32.dll" alias for "WSAStartup;Ansi" 
FUNCTION Long WSACleanup() LIBRARY "wsock32.dll"
FUNCTION Long WSAGetLastError ( ) LIBRARY "wsock32.dll"
FUNCTION ULong inet_addr( String addr) LIBRARY "wsock32.dll" alias for "inet_addr;Ansi"
FUNCTION String inet_ntoa (Long in ) LIBRARY "wsock32.dll" alias for "inet_ntoa;Ansi" 

//获取错误函数
FUNCTION Long GetLastError() LIBRARY "kernel32.dll"


global external function 定义如下:

function int WSAStartup( uint UIVersionRequested, ref s_WSAData lpWSAData ) library "wsock32.dll" alias for "WSAStartup;Ansi"
function int WSACleanup() library "wsock32.dll"
function int WSAGetLastError ( ) library "wsock32.dll"
function int gethostname ( ref string name, int namelen ) library "wsock32.dll" alias for "gethostname;Ansi"
function string GetHost(string lpszhost, ref blob lpszaddress ) library "PBWS32.DLL" alias for "GetHost;Ansi" 




------解决方案--------------------
pb9 的pbl 引入PB115 ,里面如果有包含API 的声明的,在PB115 里migrage 后会自动添加ansi什么的。
  相关解决方案