如题,求助在VB中如何定义下面这个结构体
<len(ushort)> <msg_id(ushort)><line_id(byte)>
<rtu_id(byte)><type_cnt(byte)>{<type(byte)> <obj_count(byte)>{<dev_name(char[20])><status(uint)> }}
<len(ushort)> <msg_id(ushort)><line_id(byte)>
<rtu_id(byte)><type_cnt(byte)>{<type(byte)> <obj_count(byte)>{<dev_name(char[20])><status(uint)> }}
cbSize As Long
hwnd As Long
uID As Long
uFlags As Long
uCallbackMessage As Long
hIcon As Long
szTip As String * 64
End Type
类似这样
<rtu_id(byte)> <type_cnt(byte)>{ <type(byte)> <obj_count(byte)>{ <dev_name(char[20])> <status(uint)> }}type struct_name
len as integer
msg_id as integer
line_id as byte
rtu_id as byte
type_cnt as byte
substruct1 as substruct_type1
end typetype substruct_type1
type_ as byte
obj_count as byte
substruct2 as substruct_type2
end type
type substruct_type2
dev_name as string*19
status as long
end type
uint->long
byte->byte
char->string另外不支持匿名结构,因此要单独定义。
顺带问个问题:这个结构体实际是要求我发送的数据格式,我定义完结构体后如何将数据附给变量和如何使用结构体呢?
例如(len 可以计算)
msg_id 为1
line_id 为1
rtu_id 为1
type_cnt 为2
type_ 为2
obj_count 为1
dev_name 为G0001
status 为07
我如何把数据按照这个结构体送出来?
xxx.msg_id=1
xxx.line_id=1
'...