Code:
// MapPointMgr.h
#ifndef MapPointMgrH
#define MapPointMgrH
#include <mpinterfaces.h>
#include <string>
#include <GPSData.h>
#include <atlbase.h>
#include <atlcom.h>
#include <guiddef.h>
#include <resource.h>
#include <IWordEngine.h>
extern _ATL_FUNC_INFO OnQuitInfo;
extern _ATL_FUNC_INFO OnSelectionInfo;
#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \
DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8)
typedef IID CLSID;
MIDL_DEFINE_GUID(IID, IID_ISwitch,0xBC7648FD,0xB55E,0x11D2,0xBA,0x67,0x00,0xC0,0x4F,0x8E,0xC8,0x47);
MIDL_DEFINE_GUID(IDD, IID_IWordEngine,0xAC7648FD,0xB55E,0x11D2,0xBA,0x67,0x00,0xC0,0x4F,0x8E,0xC8,0x47);
MIDL_DEFINE_GUID(IID, LIBID_WORDEVENTSLib,0xBC7648EF,0xB55E,0x11D2,0xBA,0x67,0x00,0xC0,0x4F,0x8E,0xC8,0x47);
MIDL_DEFINE_GUID(CLSID, CLSID_WordEngine,0xBC7648FC,0xB55E,0x11D2,0xBA,0x67,0x00,0xC0,0x4F,0x8E,0xC8,0x47);
MIDL_DEFINE_GUID(IWordEngine, IWordEngingeGui, 0xBC7647FC,0xB55E,0x11D2,0xBA,0x67,0x00,0xC0,0x4F,0x8E,0xC8,0x47);
class ATL_NO_VTABLE MapPointMgr :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<MapPointMgr, &CLSID_WordEngine>,
public IDispatchImpl<IWordEngine, &IID_IWordEngine, &LIBID_WORDEVENTSLib>,
public IDispEventSimpleImpl<1,MapPointMgr, &__uuidof(MapPoint::_MapEvents)>
{
public:
MapPointMgr();
BEGIN_SINK_MAP(MapPointMgr)
SINK_ENTRY_INFO(1, __uuidof(MapPoint::_MapEvents), 0x06041607, OnSelection, &OnSelectionInfo)
END_SINK_MAP()
DECLARE_REGISTRY_RESOURCEID(IDR_WORDENGINE)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(MapPointMgr)
COM_INTERFACE_ENTRY(IWordEngine) // <-- compiler starts to complain here:: error C2787: 'IWordEngine' : no GUID has been associated with this object
COM_INTERFACE_ENTRY(IDispatch)
END_COM_MAP()
BEGIN_CONNECTION_POINT_MAP(MapPointMgr)
END_CONNECTION_POINT_MAP()
~MapPointMgr(void);
STDMETHODIMP StartMapPoint();
STDMETHODIMP OnSelection( IDispatch* newSelection, IDispatch* oldSelection);
void MapPointMgr::PlacePushPin(double latitude, double longitude, const std::string &desc);
void MapPointMgr::UpdateIcon(const std::string &desc, double newLatitude, double newLongitude);
void MapPointMgr::goToCoordinates(double latitude, double longitude);
void MapPointMgr::DrawLine(double latitude1, double longitude1, double latitude2, double longitude2, int colorType, const::std::string &desc);
void MapPointMgr::Close();
private:
HRESULT hRes;
MapPoint::_Map *myMap;
MapPoint::_ApplicationPtr myMapPointPtr;
MapPoint::_Application *myMapPoint;
MapPoint::_MapPtr myMapPtr;
};
#endif //MapPointMgrH