VC制作的DLL中的核心代码如下:
student * getStudent()
{  struct student stu = {1,"Li"};
struct student *p;
p = &stu;
return p; 
}
其中
struct student 
{
int num;
char name[20];
};
现要在VB中调用getStudent这个函数,并得到相应的数据,代码如下:
Private Declare Function VarPtr Lib "MSVBVM60" (var As Any) As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Private Type student
    num As Integer
    name As String * 20
End Type
Private Declare Function getNum Lib "vcdll.dll" () As Long
Private Declare Function getStudent Lib "vcdll.dll" () As LongPrivate Sub Command2_Click()
Dim sp As Long
Dim s As student
'sp = VarPtr(s)
sp = getStudent()
CopyMemory s, ByVal sp, LenB(s)
Text1.Text = s.num
Text2.Text = s.name
End Sub
无法得到正确的数据,请高手指教。