vc 实现的DLL,接口中有一个结构体,结构体为
typedef struct{
unsigned int filter;
unsigned int lis_on;
unsigned int test;
unsigned int sleep;
unsigned int baud_rate;
unsigned char code1;
}PORT_STRUCT;函数调用为
int __stdcall CreateObjectofA1(PORT_STRUCT stu_packet);在VB中如何实现CreateObjectofA1 的参数设置
(目前如果不参进结构体的unsigned char code1;成员,VB中已经调试通过,但是加进来后就不能,提示为Bad dll calling convention)这个问题我个人认为比较有意思,请各位研究一下
typedef struct{
unsigned int filter;
unsigned int lis_on;
unsigned int test;
unsigned int sleep;
unsigned int baud_rate;
unsigned char code1;
}PORT_STRUCT;函数调用为
int __stdcall CreateObjectofA1(PORT_STRUCT stu_packet);在VB中如何实现CreateObjectofA1 的参数设置
(目前如果不参进结构体的unsigned char code1;成员,VB中已经调试通过,但是加进来后就不能,提示为Bad dll calling convention)这个问题我个人认为比较有意思,请各位研究一下
解决方案 »
- VB 无法恢复数据库,因为数据库正在使用,所以未能获得对数据库的排它访问权?
- 数组的全局赋值问题
- 为什么用SetParent设置的子窗体,在MdiForm中拖拽时,mdiform不会显示滚动条?
- 怎么让控件大小随窗体的变化而相应的变化
- vb导出excal的问题!
- 急!高分!!!vb中如何使用接口?
- VB6与VB4数据访问的差异
- 大家来看看这个语句能实现要求吗
- 急问如何实现鼠标移动时mschart实时显示鼠标点所在位置的数值
- 单VB一样,程序员工资2K在珠海,你们觉得怎样?
- 高手请进!文本文件中ASCII特殊字符的读取问题!急,在线等待!
- vc 实现的DLL,接口中有一个结构体,在VB中如何实现
unsigned int filter;
unsigned int lis_on;
unsigned int test;
unsigned int sleep;
unsigned int baud_rate;
unsigned char code1;
}PORT_STRUCT;type PORT_STRUCT
filter as long
lis_on as long
test as long
sleep as long
baud_rate as long
code1 as byte
end typeint __stdcall CreateObjectofA1(PORT_STRUCT stu_packet);
declare function CreateObjectofA1 lib "xxx.dll" (stu_packet as PORT_STRUCT) as long
我没怎么用VB调过DLL但是我在C++下出过类似的问题。
指定好调用方式应该没问题。
http://www.yesky.com/428/1857428.shtml用:
引入补位成员法
“要不调用前你再显式地给它个0“这句话,能不能详细一点谢谢先
因为你的函数声明中不是结构的指针PORT_STRUCT* stu_packet而是直接声明了结构,这样的话,你vb里面就把声明结构中各成员按顺序声明在函数的参数列表中就可以了r = CreateObjectofA1(1, 2, 3, 4, 5, 6)
我刚刚测试了,可以通过,但是我将结构体修改成
typedef struct{
unsigned int filter;
unsigned int lis_on;
unsigned int test;
unsigned int sleep;
unsigned int baud_rate;
unsigned char code1;
unsigned char code2;
}PORT_STRUCT;也就是多了一个 unsigned char code2,
其它一样,调试再次出现提示为Bad dll calling convention再来研究一下!!!
Private Sub Form_Load()
Dim r As Long
'code1=6,code2=7
r = CreateObjectofA1(1, 2, 3, 4, 5, 7 * &H100 + 6)
End Sub
感谢你们的热心帮助,有你们的存在,我们的IT一定会有希望
希望大家继续保持热情和无私,我会和你们同在
再次表示感谢!
vc 实现的DLL,接口中有一个结构体,结构体为
typedef struct{
unsigned int filter;
unsigned int lis_on;
unsigned int test;
unsigned int sleep;
unsigned int baud_rate;
unsigned char code1;
unsigned char code2;
}PORT_STRUCT;函数调用为
int __stdcall CreateObjectofA1(PORT_STRUCT stu_packet);在VB中定义为
Private Declare Function CreateObjectofA1 Lib "xxx.dll" (ByVal filter As Long, ByVal lis_on As Long, ByVal test As Long, ByVal sleep As Long, ByVal baud_rate As Long, ByVal code12 As long) As Long调用为
r = CreateObjectofA1(1, 2, 3, 4, 5, 7*&H100+6)如果在学习研究的过程中有疑问,请E_mail:[email protected]
希望我能够帮助你
再次对关心支持我的同仁们表示感谢