VC代码翻译成VB 6.0代码
VC代码:#defineChildMaxNum50typedefstruct{unsignedcharrootname[20];unsignedcharrootip[16...
VC代码:
#define ChildMaxNum 50
typedef struct
{
unsigned char rootname[20];
unsigned char rootip[16];
short port;
unsigned char deviceID[4];
unsigned char name[20];
}T_ChildType;
要求数据结构一致,数据大小一致,如rootname占用20个字节,
VB代码中也要占用20个字节,因为我是同过socket接收数据的,
VB6中好像没有short类型,我对vb不太熟悉,以下是我的vb代码,
不知对不对
Private Type T_ChildType
rootname(0 To 19) As Byte
rootip(0 To 15) As Byte
port(0 To 2) As Byte
deviceID(0 To 3) As Byte
rootname(0 To 19) As Byte
End Type
如果我通过socket接收的数据是char recbuff[1000],
我在VC中可以这样写
T_ChildType childres[ChildMaxNum];
memcpy((void*)childres,recvBuf,size);
那么在VB中不知道怎么写,vb中有没有和memcpy相当
的函数? 展开
#define ChildMaxNum 50
typedef struct
{
unsigned char rootname[20];
unsigned char rootip[16];
short port;
unsigned char deviceID[4];
unsigned char name[20];
}T_ChildType;
要求数据结构一致,数据大小一致,如rootname占用20个字节,
VB代码中也要占用20个字节,因为我是同过socket接收数据的,
VB6中好像没有short类型,我对vb不太熟悉,以下是我的vb代码,
不知对不对
Private Type T_ChildType
rootname(0 To 19) As Byte
rootip(0 To 15) As Byte
port(0 To 2) As Byte
deviceID(0 To 3) As Byte
rootname(0 To 19) As Byte
End Type
如果我通过socket接收的数据是char recbuff[1000],
我在VC中可以这样写
T_ChildType childres[ChildMaxNum];
memcpy((void*)childres,recvBuf,size);
那么在VB中不知道怎么写,vb中有没有和memcpy相当
的函数? 展开
展开全部
一两句话说不清楚,给你个VC转换VB的参数表吧
大写的是c/c++参数类型,小写的是对应VB的参数类型
integer2字节
long 4字节
byte 1字节
string 是字符数*2
ATOM byval variable as integer
BOOL byval variable as long
BYTE byval variable as byte
CHAR byval variable as byte
COLORREF byval variable as long
DWORD byval variable as long
HWND,HDC,HMENU,etc.(windows handles)byval variable as long
INT,UINT byval variable as long
LONG byval variable as long
LPARAM byval variable as long
LPDWORD byval variable as long
LPINT,LPUINT byval variable as long
LPRECT byval variable as type
LPSTR,LPCSTR byval variable as string
LPVOID byval variable as any #any variable(use byval when passing a string)
LPWORD byval variable as integer
LRESULT byval variable as long
NULL as any or byval variable as long byval nothing or byval 0& or vbnullstring
(你说的short类型在下面)
SHORT byval variable as integer
VOID sub procedure
WORD byval variable as integer
WPARAM byval variable as long
希望对你有帮助,不过能用C++的最好不用VB,麻烦!
终于打完了累啊......
大写的是c/c++参数类型,小写的是对应VB的参数类型
integer2字节
long 4字节
byte 1字节
string 是字符数*2
ATOM byval variable as integer
BOOL byval variable as long
BYTE byval variable as byte
CHAR byval variable as byte
COLORREF byval variable as long
DWORD byval variable as long
HWND,HDC,HMENU,etc.(windows handles)byval variable as long
INT,UINT byval variable as long
LONG byval variable as long
LPARAM byval variable as long
LPDWORD byval variable as long
LPINT,LPUINT byval variable as long
LPRECT byval variable as type
LPSTR,LPCSTR byval variable as string
LPVOID byval variable as any #any variable(use byval when passing a string)
LPWORD byval variable as integer
LRESULT byval variable as long
NULL as any or byval variable as long byval nothing or byval 0& or vbnullstring
(你说的short类型在下面)
SHORT byval variable as integer
VOID sub procedure
WORD byval variable as integer
WPARAM byval variable as long
希望对你有帮助,不过能用C++的最好不用VB,麻烦!
终于打完了累啊......
微测检测5.10
2023-05-10 广告
2023-05-10 广告
您好!建议咨 深圳市微测检测有限公司,已建立起十余个专业实验室,企业通过微测检测就可以获得一站式的测试与认 证解决方案;(EMC、RF、MFi、BQB、QI、USB、安全、锂电池、快充、汽车电子EMC、汽车手机互 联、语音通话质量),认证遇...
点击进入详情页
本回答由微测检测5.10提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询