18.04.2015 Views

ArcGIS Engine Developer Guide

ArcGIS Engine Developer Guide

ArcGIS Engine Developer Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

VISUAL C++<br />

5. Clicking OK will modify your ATL class and generate the proxy classes in a<br />

header file, with a name ending in CP, for firing events.<br />

If the wizard fails to run, use the following example, which illustrates a<br />

coclass that is a source of ITOCControlEvents, a pure dispatch interface.<br />

#pragma once<br />

#include "resource.h" // Main symbols<br />

#include "TOCControlCP.h" // Include generated connection point class<br />

for firing events.<br />

//////////////////////////////////////////////////////////////////////////<br />

// CMyEventSource<br />

class ATL_NO_VTABLE CMyEventSource :<br />

public CComObjectRootEx,<br />

public CComCoClass,<br />

public IMyEventSource,<br />

public CProxyITOCControlEvents< CMyEventSource >, // Generated<br />

ConnectionPoint class<br />

public IConnectionPointContainerImpl< CMyEventSource > // Implementation<br />

of Connection point Container<br />

{<br />

public:<br />

CMyEventSource()<br />

{<br />

}<br />

DECLARE_REGISTRY_RESOURCEID(IDR_MYEVENTSOURCE)<br />

DECLARE_PROTECT_FINAL_CONSTRUCT()<br />

BEGIN_COM_MAP(CMyEventSource)<br />

COM_INTERFACE_ENTRY(IMyEventSource)<br />

COM_INTERFACE_ENTRY(IConnectionPointContainer) // Allow QI to this<br />

interface.<br />

END_COM_MAP()<br />

// List of available connection points<br />

136 • <strong>ArcGIS</strong> <strong>Engine</strong> <strong>Developer</strong> <strong>Guide</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!