VC中的结构体,在VB中怎么定义呢
typedef struct _MY_RECORD_SET
{
int Ver;
int Year;
int Month;
int Day;
long times;
char FileVer[SW_VER_LEN];//SW_VER_LEN=30
char DongleID[20];
}MY_RECORD_SET ;
本人VB不熟悉;那位指点一下.
在VC的DLL中函数为
int __stdcall getLimit(MY_RECORD_SET *setRecord)
如何调用呢;20分奉上;不够再给了.谢谢
[解决办法]
Const SW_VER_LEN = 30
Type MY_RECORD_SET
Ver As Long
Year As Long
Month As Long
Day As Long
times As Currency
FileVer(SW_VER_LEN - 1) As Byte
DongleID(20 - 1) As Byte
End Type
Declare Function getLimit Lib "MyLib.dll " (setRecord As MY_RECORD_SET) As Long
Sub Main()
Dim mrs As MY_RECORD_SET
Dim ret As Long
ret = getLimit(mrs)
If ret = <成功> Then
Debug.Print "Ver= " & mrs.Ver
Debug.Print "Year= " & mrs.Year
Debug.Print "Month= " & mrs.Month
Debug.Print "Day= " & mrs.Day
Debug.Print "times= " & (CDec(mrs.times) * CDec(10000)) '用 Currency 模拟 Int64 需要的取值运算
Debug.Print "FileVer= " & StrConv(mrs.FileVer, vbUnicode)
Debug.Print "DongleID= " & StrConv(mrs.DongleID, vbUnicode)
Else
Debug.Print "错误: " & ret
End If
End Sub