DLL中的函数的参数是个结构体,如下:
typedef struct _tmp {
int num;
union {
int a;
float b;
char c[256];
} value;
} tmp;我在VB中用type定义的类型来表示,但这个union如何来实现?
typedef struct _tmp {
int num;
union {
int a;
float b;
char c[256];
} value;
} tmp;我在VB中用type定义的类型来表示,但这个union如何来实现?
解决方案 »
- 求助activereport 如何判断第10条,第20条...数据
- 没有主键的情况下,用update怎么修改指定行的纪录呀
- 哪个高手能给我一段源代码啊???
- VB如何对一个文本文件进行写和清空操作呢?高手帮忙,谢先!!
- 如何用vb编写收发邮件的代码!急,在线等待!
- 大家新年好!这里有人用过用友软件吗?
- vb中数据集的内容如何加载到listview这个控件上
- 如何取得一个mciSendString打开的视屏窗口的句柄?并在其中定义弹出菜单?请给点代码帮助。
- vb中与或运算怎么实现
- 请问如何学习VBS?
- 高分:求CSDN离线浏览器的源码,请指教
- 我写的FTP代码,可以连接到服务器,但是不可以上传文件,头痛啊~~帮忙!!
num as integer
a as integer
End Type
Type _tmp2
num as integer
b as single
end typetype _tmp3
num as integer
c as string *256
end type
num as long'int 相当与long ,都是4个字节
value(255) as byte '取最大的一个 然后 使用CopyMemory把数组格式化成相应的 类型
End Type
CopyMemory的用法能不能说明一下。
num as long
value(255) as byte
end typedim a as long
dim b as single
dim x as tmp
...
copymemory a,x.value(0),4
copymemory b,x.value(0),4
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
union中的成员的首地址相同,占用字节数取成员中占用最大那个!!