当前位置: 代码迷 >> PB >> pb怎么调用带结构参数的动态库
  详细解决方案

pb怎么调用带结构参数的动态库

热度:50   发布时间:2016-04-29 08:28:43.0
pb如何调用带结构参数的动态库
用VB可以调用成功具体调用如下:
Function DSGetModemByPosition Lib "gprsdll.dll" (ByVal Index As Long, modeminfo As ModemInfoStruct) As Long
结构体为:
Public Type ModemInfoStruct
  M_modemid As Long  
  M_phoneno(0 To 11) As Byte  
  M_dynip(0 To 3) As Byte  
  M_conn_time As Long  
  M_refresh_time As Long  
End Type
用PB是这样写的,不知在哪儿有问题:
 Function Long DSGetModemByPosition(Long Index,str_ModemInfoStruct modeminfo) LIBRARY "GPRSDLL.DLL"
结构体为:
str_ModemInfoStruct:
long m_modemid
byte m_phoneno
byte m_dynip
long m_conn_time
long m_refresh_time
为什么调用时取不到值?

------解决方案--------------------

试下这个
str_ModemInfoStruct:
long m_modemid
character m_phoneno[12]
character m_dynip[4] 
long m_conn_time
long m_refresh_time

------解决方案--------------------
Function Long DSGetModemByPosition(Long Index,ref str_ModemInfoStruct modeminfo) LIBRARY "GPRSDLL.DLL"
加上ref
  相关解决方案