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

VB与PB转换有关问题

2012-03-16 
VB与PB转换问题请各位大虾帮帮忙看看,在线等。。。呵呵VB中函数申明:Declare Function AdxDioReadDiPorts Lib

VB与PB转换问题
请各位大虾帮帮忙看看,在线等。。。呵呵
VB中函数申明:
Declare Function AdxDioReadDiPorts Lib "adsapi32.dll" (ByVal DriverHandle As Long, ByVal dwPortStart As Long, ByVal dwPortCount As Long, ByRef pBuffer As Byte) As Long 函数调用:
  Dim npData() As Byte
  nPortStart = Int(DOSPortStart.Text)
  nPortCount = Int(DOSPortCount.Text)
  ReDim npData(0 To nPortCount)
  lErrCde = AdxDioReadDiPorts(m_lDevHandle, nPortStart, nPortCount, npData(0))
我在PB里面函数的申明:
Function Long AdxDioReadDiPorts (ref Long DriverHandle,long dwPortStart,long dwPortCount,ref char pBuffer) LIBRARY "adsapi32.dll"调用:
  long nPortStart 
  nPortStart = 0
  long nPortCount
  nPortCount = 1
  char pBuffer
  pBuffer=space(1000)

  ErrCde = AdxDioReadDiPorts(ref DriverHandle, nPortStart, nPortCount, ref pBuffer)

备注(DriverHandle为设备句柄,能正常打开设备)
问题:1、我这么申明的时候,在函数调用的时候提示PB错误。。。请问函数申明应该怎么修改呢?
2、我应该怎么调用这个函数呢?
请各位大虾帮帮忙看看,在线等。。。呵呵

[解决办法]
pb几?
10以下:
Function Long AdxDioReadDiPorts (Long DriverHandle,long dwPortStart,long dwPortCount,ref string pBuffer) LIBRARY "adsapi32.dll"

[解决办法]
调用:
ErrCde = AdxDioReadDiPorts(DriverHandle, nPortStart, nPortCount, pBuffer)


[解决办法]
ref char pBuffer
或者
ref char pBuffer[]

热点排行