Global Mapper Pro

GM_AddCustomAreaClass FUNCTION

Dilys Global Mapper UserTrusted User
edited September 2009 in SDK
Hi Mike,

I tried to call the GM_AddCustomAreaClass(string, GM_AreaSTyle_t, Int16), it gave me an Error code 2.

Could you let me know what wrong with my definitions?

Public Declare Function GM_AddCustomAreaClass Lib "GlobalMapperInterface" _
( _
ByVal aName As String, _
ByVal aStyle As GM_AreaStyle_t, _
ByRef aFeatureCode As Int16 _
) As Int32

<StructLayout(LayoutKind.Sequential)> Public Structure GM_AreaStyle_t
Public mBorderPenStyle As GM_PenStyle_t16
Public mBorderPenWidth As Int16
Public mBorderPenColor As Integer
Public mBrushColor As Integer
Public mBrushStyle As GM_BrushStyle_t16
Public mDrawLabel As Byte
Public mDrawLabelAlways As Byte
Public mFont As GM_FontDef_t
End Structure

<StructLayout(LayoutKind.Sequential)> Public Structure GM_FontDef_t
Public mFaceName As String
Public mColor As Integer
Public mWeight As Int16
Public mPointSize As Byte
Public mItalicize As Byte
Public mUnderline As Byte
Public mStrikeout As Byte
Public mCharset As Byte
Public mBgMode As GM_FontBackground_t8
Public mFixedHgt As Single
Public mPlacement As GM_LabelPlacement_t8
Public mReserved1 As Byte
Public mReserved2 As Byte
Public mReserved3 As Byte
Public mAngle As Single
End Structure

Thanks in advance!



  • global_mapper
    global_mapper Administrator
    edited September 2009

    Your aAreaStyle parameter should be passed ByRef rather than ByVal since you need the pointer to the structure passed in and not a copy of the structure.

    Let me know if I can be of further assistance.


    Global Mapper Support
  • Dilys
    Dilys Global Mapper User Trusted User
    edited September 2009
    Oh, yes!

    Thanks Mike!

Sign In or Register to comment.