两个动态库的原形如下,
int _stdcall IFD_InitComm(char *portname, unsigned long baud)int _stdcall IFD_SLE4442_Read(unsigned int Address, unsigned char Len, unsigned char *rData)以上两个函数,我在VB中是这样申明的:
Public Declare Function IFD_InitComm Lib "IFD_API.dll" (ByVal Pportname, baud As Long)Public Declare Function IFD_SLE4442_Read Lib "IFD_API.dll" (Address As Long, Lend As Long, ByRef PrData As Long) As Long]在VB中,调用时总是出现错误,如果调用成功反回值是0
有谁知怎么调用??我给分
int _stdcall IFD_InitComm(char *portname, unsigned long baud)int _stdcall IFD_SLE4442_Read(unsigned int Address, unsigned char Len, unsigned char *rData)以上两个函数,我在VB中是这样申明的:
Public Declare Function IFD_InitComm Lib "IFD_API.dll" (ByVal Pportname, baud As Long)Public Declare Function IFD_SLE4442_Read Lib "IFD_API.dll" (Address As Long, Lend As Long, ByRef PrData As Long) As Long]在VB中,调用时总是出现错误,如果调用成功反回值是0
有谁知怎么调用??我给分
解决方案 »
- vb中savepicture保存picture.image问题
- 图标问题
- 关于很简单的VB程序编写
- 点击保存对话框的保存按钮之后文件就自动保存了吗?还要编程写保存代码吗?
- 树型节点的拖拽?
- starsoulxp(星魂) suolong123(锁龙) 进来
- 删除日期时 若填入时间是Now 型,删除使用 writedate=#"& 2003-11-09 &"#"不掉
- 请高手写程序
- 如何判断输入的是英文还是汉字。
- 怎样检测一个目录下的那些文件被读取(有急用,给帮助就给分)?
- 急求:请问关于判断一个点是否在任意多边形内,这个点能否是单精度型的,哪位大哥大姐给看看
- 怎么样把VB中Iamge中的图片拿出来?
int _stdcall IFD_InitComm(char *portname, unsigned long baud) int _stdcall IFD_SLE4442_Read(unsigned int Address, unsigned char Len, unsigned char *rData)
是函数原形吧?
还有就是你这种申明方式的函数,dll一般都应该放在STSTEM32目录下,
不过,我建议最好是采用引用,就不用怎么麻烦了
以指针形式传递字符串,在VB中应该用ByRef。 Public Declare Function IFD_SLE4442_Read Lib "IFD_API.dll" (Address As Long, Lend As Long, ByRef PrData As Long) As Long]
prdata可以用ByVal来传递。另外在函数字义时没有返回值类型,应加上。
Dim ret As Long, addr As Long, length As Long
Dim data(255) As Byteaddr = 0
length = 16
ret = IFD_SLE4442_Read(addr, length, data(0))
Public Declare Function IFD_SLE4442_Read Lib "IFD_API.dll" (Byval Address As Long, Byval Lend As Byte, rData As Any) As Long Dim ret As Long, addr As Long, length As byte
Dim data(255) As Byte addr = 11223344
length = 16
ret = IFD_SLE4442_Read(addr, length, data(0))