忙活大半天,外部函数调用的问题终没解决。
下班了,换个函数,不知道是否容易一些,请大家多多帮忙了
问题:
求动态库abc.dll中函数OpenComm在PowerBilder中的函数声明和调用代码
函数原型:int OpenComm(HANDLE *hCom,char *com_port)
功能说明:打开计算机串口。
输入参数:
●——hCom:串口句柄
●——com_port:串口文件名
调用例程:
char comm[]="COM1";
OpenComm(&h_Com,comm);
if(h_Com != INVALID_HANDLE_VALUE)
{
AfxMessageBox("打开串口成功!");
}
else
{
AfxMessageBox("打开串口失败!");
}
------解决方案--------------------
function int OpenComm(ref ulong hCom, string com_port) library 'EPCDemoDll.dll'
ulong h_Com
string comm = "COM1"
OpenComm(h_Com,comm);
if h_Com <> INVALID_HANDLE_VALUE then
MessageBox("", "打开串口成功!")
else
MessageBox("", "打开串口失败!")
end if
------解决方案--------------------
参数类型不匹配。