// Commands.h : header file // #if !defined(AFX_COMMANDS_H__36FDE876_EA61_11D0_B595_00A0C91BC942__INCLUDED_) #define AFX_COMMANDS_H__36FDE876_EA61_11D0_B595_00A0C91BC942__INCLUDED_ #include "bldrecTypes.h" class CCommands : public CComDualImpl, public CComObjectRoot, public CComCoClass { protected: IApplication* m_pApplication; public: CCommands(); ~CCommands(); void SetApplicationObject(IApplication* m_pApplication); IApplication* GetApplicationObject() { return m_pApplication; } void UnadviseFromEvents(); BEGIN_COM_MAP(CCommands) COM_INTERFACE_ENTRY(IDispatch) COM_INTERFACE_ENTRY(ICommands) END_COM_MAP() DECLARE_NOT_AGGREGATABLE(CCommands) protected: CString m_strFile; // This class template is used as the base class for the Application // event handler object and the Debugger event handler object, // which are declared below. template class XEventHandler : public CComDualImpl, public CComObjectRoot, public CComCoClass { public: BEGIN_COM_MAP(XEvents) COM_INTERFACE_ENTRY(IDispatch) COM_INTERFACE_ENTRY_IID(*piidEvents, IEvents) END_COM_MAP() DECLARE_NOT_AGGREGATABLE(XEvents) void Connect(IUnknown* pUnk) { VERIFY(SUCCEEDED(AtlAdvise(pUnk, this, *piidEvents, &m_dwAdvise))); } void Disconnect(IUnknown* pUnk) { AtlUnadvise(pUnk, *piidEvents, m_dwAdvise); } CCommands* m_pCommands; protected: DWORD m_dwAdvise; }; // This object handles events fired by the Application object class XApplicationEvents : public XEventHandler { public: // IApplicationEvents methods STDMETHOD(BeforeBuildStart)(THIS); STDMETHOD(BuildFinish)(THIS_ long nNumErrors, long nNumWarnings); STDMETHOD(BeforeApplicationShutDown)(THIS); STDMETHOD(DocumentOpen)(THIS_ IDispatch * theDocument); STDMETHOD(BeforeDocumentClose)(THIS_ IDispatch * theDocument); STDMETHOD(DocumentSave)(THIS_ IDispatch * theDocument); STDMETHOD(NewDocument)(THIS_ IDispatch * theDocument); STDMETHOD(WindowActivate)(THIS_ IDispatch * theWindow); STDMETHOD(WindowDeactivate)(THIS_ IDispatch * theWindow); STDMETHOD(WorkspaceOpen)(THIS); STDMETHOD(WorkspaceClose)(THIS); STDMETHOD(NewWorkspace)(THIS); }; typedef CComObject XApplicationEventsObj; XApplicationEventsObj* m_pApplicationEventsObj; // This object handles events fired by the Application object class XDebuggerEvents : public XEventHandler { public: // IDebuggerEvents method STDMETHOD(BreakpointHit)(THIS_ IDispatch * pBreakpoint); }; typedef CComObject XDebuggerEventsObj; XDebuggerEventsObj* m_pDebuggerEventsObj; public: BOOL SaveFileName(); CTime m_theLastTime; BOOL MarkTime(LPCSTR szItem, BOOL fStart); // ICommands methods STDMETHOD(BldrecCommandMethod)(THIS); }; typedef CComObject CCommandsObj; //{{AFX_INSERT_LOCATION}} // Microsoft Developer Studio will insert additional declarations immediately before the previous line. #endif // !defined(AFX_COMMANDS_H__36FDE876_EA61_11D0_B595_00A0C91BC942__INCLUDED)