指针转成结构体数组
本帖最后由 woshiqinxue 于 2013-01-17 10:59:49 编辑 使用VC编写的DLL,定义了一个结构体,并且接口中有一个参数是结构体的数组如下:
typedef struct _StructInfo
{
RECT rc;
BYTE iAtt;
BYTE bitinfo;
BYTE bitSet;
}
StructInfo, FAR * LPStructInfo;
long WINAPI GetInfoFromFile( int nFlag, int nMax, LPStructInfo pStruct, int *nCount);
Structure StructInfo
Dim rc As RECT
Dim iAtt As Byte
Dim bitinfo As Byte
Dim bitSet As Long
End Structure
Public Declare Function GetInfoFromFile Lib "RecgImage.dll" (ByVal nFlag As Integer, ByVal nMax As Integer, ByRef pStruct As IntPtr, ByRef nCount As IntPtr) As Integer
dim rt as regionType
rt=CType(System.Runtime.InteropServices.Marshal.PtrToStructure(ptr,GetType(regionType)),regionType)