///////////////////////////////////////////////////////////////////// // ActiveX.h : Declaration of the CActiveX // // ActiveX Control for Demonstration // // Language: C++, MSVC++ .Net, ATL 7.0 // // Platform: Compaq, WinXP, SP1, MSDEV 7.0, .Net 1.0 // // Application: CSE775 - Distributed Objects processing, Spring' 03// // Author: Srinivasa Neerudu, MSCE, Syracuse University // // email:srneerud@ecs.syr.edu // ///////////////////////////////////////////////////////////////////// // ActiveX.h : Declaration of the CActiveX //Public Interface: //------------------ //acceptPath(BSTR path) - accepts a path to start navigation for all files. // initiates another thread and Creates Instance of the same control // to do processing. This helps stop freezing for client. //startProcessing(CHAR *path) - accepts a path to start navigation for all files. // This will freeze the client (client has to call on its thread to avoid freezing). //Design Notes: //-------------- //Implemented as singleton. Thread is spawned on a call to acceptPath. Another instance of the same client //is created but since it is a singleton we get the same instance. Avoids freezing of client. //Fires file_Found(pathOfFile) event for each file found. // #pragma once #include "resource.h" // main symbols #include #include "ActiveXDemo.h" #include "_IActiveXEvents_CP.h" #include #include #include #include #include using namespace std; // CActiveX class ATL_NO_VTABLE CActiveX : public CComObjectRootEx, public CStockPropImpl, public IPersistStreamInitImpl, public IOleControlImpl, public IOleObjectImpl, public IOleInPlaceActiveObjectImpl, public IViewObjectExImpl, public IOleInPlaceObjectWindowlessImpl, public ISupportErrorInfo, public IConnectionPointContainerImpl, public CProxy_IActiveXEvents, public IPersistStorageImpl, public ISpecifyPropertyPagesImpl, public IQuickActivateImpl, public IDataObjectImpl, public IProvideClassInfo2Impl<&CLSID_ActiveX, &__uuidof(_IActiveXEvents), &LIBID_ActiveXDemoLib>, public IPropertyNotifySinkCP, public CComCoClass, public CComControl { public: CActiveX():path(new char[512]) { } DECLARE_OLEMISC_STATUS(OLEMISC_RECOMPOSEONRESIZE | OLEMISC_ACTSLIKELABEL | OLEMISC_CANTLINKINSIDE | OLEMISC_INSIDEOUT | OLEMISC_ACTIVATEWHENVISIBLE | OLEMISC_SETCLIENTSITEFIRST ) DECLARE_REGISTRY_RESOURCEID(IDR_ACTIVEX) DECLARE_NOT_AGGREGATABLE(CActiveX) BEGIN_COM_MAP(CActiveX) COM_INTERFACE_ENTRY(IActiveX) COM_INTERFACE_ENTRY(IDispatch) COM_INTERFACE_ENTRY(IViewObjectEx) COM_INTERFACE_ENTRY(IViewObject2) COM_INTERFACE_ENTRY(IViewObject) COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless) COM_INTERFACE_ENTRY(IOleInPlaceObject) COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless) COM_INTERFACE_ENTRY(IOleInPlaceActiveObject) COM_INTERFACE_ENTRY(IOleControl) COM_INTERFACE_ENTRY(IOleObject) COM_INTERFACE_ENTRY(IPersistStreamInit) COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit) COM_INTERFACE_ENTRY(ISupportErrorInfo) COM_INTERFACE_ENTRY(IConnectionPointContainer) COM_INTERFACE_ENTRY(ISpecifyPropertyPages) COM_INTERFACE_ENTRY(IQuickActivate) COM_INTERFACE_ENTRY(IPersistStorage) COM_INTERFACE_ENTRY(IDataObject) COM_INTERFACE_ENTRY(IProvideClassInfo) COM_INTERFACE_ENTRY(IProvideClassInfo2) END_COM_MAP() BEGIN_PROP_MAP(CActiveX) PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4) PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4) PROP_ENTRY("BackColor", DISPID_BACKCOLOR, CLSID_StockColorPage) PROP_ENTRY("BorderColor", DISPID_BORDERCOLOR, CLSID_StockColorPage) PROP_ENTRY("BorderStyle", DISPID_BORDERSTYLE, CLSID_NULL) PROP_ENTRY("BorderVisible", DISPID_BORDERVISIBLE, CLSID_NULL) PROP_ENTRY("BorderWidth", DISPID_BORDERWIDTH, CLSID_NULL) PROP_ENTRY("ForeColor", DISPID_FORECOLOR, CLSID_StockColorPage) PROP_ENTRY("Text", DISPID_TEXT, CLSID_NULL) // Example entries // PROP_ENTRY("Property Description", dispid, clsid) // PROP_PAGE(CLSID_StockColorPage) END_PROP_MAP() BEGIN_CONNECTION_POINT_MAP(CActiveX) CONNECTION_POINT_ENTRY(IID_IPropertyNotifySink) CONNECTION_POINT_ENTRY(__uuidof(_IActiveXEvents)) END_CONNECTION_POINT_MAP() BEGIN_MSG_MAP(CActiveX) CHAIN_MSG_MAP(CComControl) DEFAULT_REFLECTION_HANDLER() END_MSG_MAP() // Handler prototypes: // LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); // LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); // LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled); // ISupportsErrorInfo STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid) { static const IID* arr[] = { &IID_IActiveX, }; for (int i=0; i