首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > PB >

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

2012-03-27 
pb如何调用带结构参数的动态库用VB可以调用成功具体调用如下:Function DSGetModemByPosition Lib gprsdll

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:
longm_modemid
bytem_phoneno
bytem_dynip
longm_conn_time
longm_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

热点排行