mappin.gif (313 bytes)CMapPin v1.10

Welcome to CMapPin, a freeware MFC classes to provide map pins useful in GIS applications. Here's a small sample of what the map pins look like when overlaid on a bitmap map:

CMapPin example

 

 

Features
Usage
Copyright
History
API Reference
Contacting the Author

 

 

 

Features

 

 

 

Usage

 

 

 

Copyright

 

 

 

History

v1.10 (16 April 2022)

v1.09 (9 May 2020)

v1.08 (28 March 2020)

v1.07 (3 June 2019)

v1.06 (30 December 2018)

v1.05 (31 December 2016)

v1.04 (24 March 2001)

v1.03 (1 August 2000)

v1.02 (12 June 2000)

v1.01 (12 September 1998)

v1.0 (13 August 1998)

 

 

 

API Reference

The API consists of the the public member functions of the class CMapPin:

 

CMapPin
~CMapPin

Create
SetIcon
GetIcon
SetPopupMenu
SetAllowDrag
GetAllowDrag

 

CMapPin::CMapPin

CMapPin();

Remarks

Standard C++ constructor. Just initializes internal variables to a default value.

 

CMapPin::~CMapPin

~CMapPin();

Remarks

Standard C++ destructor. Internally it will free any resources used by this instance.

 

CMapPin::Create

BOOL Create(LPCTSTR pszTooltipText, DWORD dwStyle, const CPoint& p, CWnd* pParent, UINT nID);

Return Value

Nonzero if successful; otherwise 0.

Parameters

pszTooltipText Specifies the tooltip text to use for the control. If NULL, no text will be visible.

dwStyle Specifies the control's window style. Normally this will just be WS_CHILD and WS_VISIBLE.

p Specifies the position of the control. The size will be taken from the attached icon.

pParentWnd Specifies the controls parent window, usually your CView derived class. It must not be NULL.

nID Specifies the control's control ID.

Remarks

Construct a CMapPin object in three steps. First call the constructor, then SetIcon and then call Create, which creates the Windows control and attaches it to the CMapPin object.

Apply the following window styles to a map pin control:

 

 

CMapPin::SetIcon

bool SetIcon(HINSTANCE hModule, LPCTSTR pszResourceID, int nCXIcon = GetSystemMetrics(SM_CXSMICON), int nCYIcon = GetSystemMetrics(SM_CYSMICON));
bool SetIcon(HINSTANCE
hModule, UINT nResourceID, int nCXIcon= GetSystemMetrics(SM_CXSMICON), int nCYIcon = GetSystemMetrics(SM_CYSMICON));

Return Value

true if successful otherwise false.

Parameters

hModule Handle to an instance of the module whose executable file contains the icon to be loaded.

pszResourceID Pointer to a null-terminated string that contains the name of the icon resource to be loaded.

nResourceID The resource identifier of the icon resource to be loaded.

nCXIcon Specifies the width of the icon to use.

nCYIcon Specifies the height of the icon to use.

Remarks

Modifies the icon to be displayed on the map pin.

 

CMapPin::GetIcon

HICON GetIcon() const;

Return Value

Returns the handle of the icon currently being used by this map pin instance.

 

CMapPin::SetPopupMenu

void SetPopupMenu(LPCTSTR pszResourceID);
void SetPopupMenu(UINT
nResourceID);

Parameters

pszResourceID Pointer to a null-terminated string that contains the name of the menu resource to be used.

nResourceID The resource identifier of the menu resource to be used.

Remarks

Sets which menu resource will be used in context menus for this map pin instance.

 

CMapPin::SetAllowDrag

void SetAllowDrag(bool bAllowDrag);

Parameters

bAllowDrag true if you want to allow the map pin be dragable, false will disallow dragging.

Remarks

Changes whether or not the map pin can be dragged around.

 

CMapPin::GetAllowDrag

bool GetAllowDrag() const;

Return Value

true if the instance allows dragging, otherwise false.

 

 

 

Contacting the Author

PJ Naughter
Email: pjna@naughter.com
Web: http://www.naughter.com
16 April 2022