L
Lance
Hi all,
I've got a some structures defined as
//////
<StructLayout(LayoutKind.Sequential)> Public Structure GM_LayerInfo_t
Public mDescription As String
Public mNativeRect As GM_Rectangle_t
Public mGlobalRect As GM_Rectangle_t
Public mPixelWidth As Int32
Public mPixelHeight As Int32
Public mNativeProj As GM_Projection_t
Public mControlPoints As IntPtr
Public mNumGCPs As Int32
Public mMinElevation As Single
Public mMaxElevation As Single
Public mNumAreas As Int32
Public mNumLines As Int32
Public mNumPoints As Int32
Public mPixelSizeX As Double
Public mPixelSizeY As Double
Public mHasRasterData As Byte
Public mEnabled As Byte
Public mHasVectorData As Byte
Public mUsedDefaultPos As Byte
Public mFilename As String
Public mArchiveFilename As String
Public mTypeName As String
End Structure
<StructLayout(LayoutKind.Sequential)> Public Structure GM_ProjAttrValue_t
Public mAttr As PROJATTR
Public mValue As Double
End Structure
<StructLayout(LayoutKind.Sequential)> Public Structure GM_Projection_t
Public mProjSys As PROJSYS
Public mDatum As DATUM
Public mUnit As UNIT
Public mNumAttrs As Int32
<VBFixedArray(15)> Public mAttrList() As GM_ProjAttrValue_t
End Structure
///////
The Types PROJATTR, PROJSYS, DATUM, and UNIT are defined enums while GM_Rectangle_t is
another structure but these are not part of the problem (at lease I'm farily positive
they're not). It's the array in the GM_Projection_t structure that seems to be the
problem. Here it's fixed, but I've also attempted just leaving it dynamic and the same
problem occurs.
The array *should* almost always contains at least 1 element in it after fill the
structure (but it could be empty or it could contain up to 16 at max). Anyway, mAttrList
is always NOTHING when ever I fill the structure as it's coded above. (the code to fill
it at the botom of this message). Every other member of the structure is filled in fine.
However, if I don't make mAttrList an array - just defined within the structure as
/////
Public mAttrList As GM_ProjAttrValue_t
/////
then mAttrList is properly filled with the mAttr and mValue members of the
GM_ProjAttrValue_t structure (remember, there's *almost always* at least one attribute to
fill the mAttrList).
Here is the code making the call to fill the strucure
/////
' Convert the pointer to our structure
Dim theLayerInfo As GM_LayerInfo_t
theLayerInfo = CType(Marshal.PtrToStructure(theLayerInfoPtr, GetType(GM_LayerInfo_t)),
GM_LayerInfo_t)
/////
I've got a some structures defined as
//////
<StructLayout(LayoutKind.Sequential)> Public Structure GM_LayerInfo_t
Public mDescription As String
Public mNativeRect As GM_Rectangle_t
Public mGlobalRect As GM_Rectangle_t
Public mPixelWidth As Int32
Public mPixelHeight As Int32
Public mNativeProj As GM_Projection_t
Public mControlPoints As IntPtr
Public mNumGCPs As Int32
Public mMinElevation As Single
Public mMaxElevation As Single
Public mNumAreas As Int32
Public mNumLines As Int32
Public mNumPoints As Int32
Public mPixelSizeX As Double
Public mPixelSizeY As Double
Public mHasRasterData As Byte
Public mEnabled As Byte
Public mHasVectorData As Byte
Public mUsedDefaultPos As Byte
Public mFilename As String
Public mArchiveFilename As String
Public mTypeName As String
End Structure
<StructLayout(LayoutKind.Sequential)> Public Structure GM_ProjAttrValue_t
Public mAttr As PROJATTR
Public mValue As Double
End Structure
<StructLayout(LayoutKind.Sequential)> Public Structure GM_Projection_t
Public mProjSys As PROJSYS
Public mDatum As DATUM
Public mUnit As UNIT
Public mNumAttrs As Int32
<VBFixedArray(15)> Public mAttrList() As GM_ProjAttrValue_t
End Structure
///////
The Types PROJATTR, PROJSYS, DATUM, and UNIT are defined enums while GM_Rectangle_t is
another structure but these are not part of the problem (at lease I'm farily positive
they're not). It's the array in the GM_Projection_t structure that seems to be the
problem. Here it's fixed, but I've also attempted just leaving it dynamic and the same
problem occurs.
The array *should* almost always contains at least 1 element in it after fill the
structure (but it could be empty or it could contain up to 16 at max). Anyway, mAttrList
is always NOTHING when ever I fill the structure as it's coded above. (the code to fill
it at the botom of this message). Every other member of the structure is filled in fine.
However, if I don't make mAttrList an array - just defined within the structure as
/////
Public mAttrList As GM_ProjAttrValue_t
/////
then mAttrList is properly filled with the mAttr and mValue members of the
GM_ProjAttrValue_t structure (remember, there's *almost always* at least one attribute to
fill the mAttrList).
Here is the code making the call to fill the strucure
/////
' Convert the pointer to our structure
Dim theLayerInfo As GM_LayerInfo_t
theLayerInfo = CType(Marshal.PtrToStructure(theLayerInfoPtr, GetType(GM_LayerInfo_t)),
GM_LayerInfo_t)
/////