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 的参数设置
这个问题我个人认为比较有意思,请各位研究一下
typedef struct{
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 type
int __stdcall CreateObjectofA1(PORT_STRUCT stu_packet);
declare function CreateObjectofA1 lib "xxx.dll" (stu_packet as PORT_STRUCT) as long
应该是这个问题了.
建议楼主看看这个:
http://www.yesky.com/428/1857428.shtml
用:
引入补位成员法
个人以为,与其补位,不如直接用long,反正都是浪费空间.
用LONG会不行吗?在VB里你把这个结构元素改为LONG再调用API,API也只是把最低位的那个BYTE拿来修改,返回后那个LONG变量的值就是无符号的CHAR的值,怎么会不对?要不调用前你再显式地给它个0。