home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / addins / brkpntmgr / brkpnts.h < prev    next >
C/C++ Source or Header  |  1998-04-03  |  3KB  |  88 lines

  1. // BrkPnts.h : Declaration of the CBrkPnts
  2.  
  3. #ifndef __BRKPNTS_H_
  4. #define __BRKPNTS_H_
  5.  
  6. #include "DlgBrkPnts.h"    // Added by ClassView
  7. #include "resource.h"       // main symbols
  8. #include <ObjModel\addguid.h>
  9. #include <ObjModel\appguid.h>
  10. #include <ObjModel\bldguid.h>
  11. #include <ObjModel\textguid.h>
  12. #include <ObjModel\dbgguid.h>
  13.  
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CBrkPnts
  16. class ATL_NO_VTABLE CBrkPnts : 
  17.     public CComObjectRootEx<CComSingleThreadModel>,
  18.     public CComCoClass<CBrkPnts, &CLSID_BrkPnts>,
  19.     public IDispatchImpl<IApplicationEvents, &IID_IApplicationEvents, &LIBID_BRKPNTMGRLib>,
  20.     public IDispatchImpl<IDebuggerEvents, &IID_IDebuggerEvents, &LIBID_BRKPNTMGRLib>,
  21.     public IDSAddIn,
  22.     public IDispatchImpl<IBrkPnts, &IID_IBrkPnts, &LIBID_BRKPNTMGRLib>
  23. {
  24. public:
  25.     CBrkPnts();
  26.     ~CBrkPnts();
  27.     HRESULT GetBrkPnts();
  28.  
  29. DECLARE_REGISTRY_RESOURCEID(IDR_BRKPNTS)
  30.  
  31. BEGIN_COM_MAP(CBrkPnts)
  32.     COM_INTERFACE_ENTRY_IID(IID_IBrkPnts, IBrkPnts)
  33.     COM_INTERFACE_ENTRY2(IDispatch, IBrkPnts)
  34.     COM_INTERFACE_ENTRY_IID(IID_IDSAddIn, IDSAddIn)
  35.     COM_INTERFACE_ENTRY_IID(IID_IApplicationEvents, IApplicationEvents)
  36.     COM_INTERFACE_ENTRY_IID(IID_IDebuggerEvents, IDebuggerEvents)
  37. END_COM_MAP()
  38.  
  39.     CComPtr<IApplication> m_spApplication;
  40.     CComPtr<IDispatch> m_pDispBrkPnts;
  41.     CComQIPtr<IBreakpoints, &IID_IBreakpoints> m_pBrkPnts;
  42.     DWORD m_dwAddInID;
  43.     DWORD m_dwAppEvents;
  44.     DWORD m_dwDbgEvents;
  45.  
  46. // IDSAddIn methods
  47. public:
  48.     STDMETHOD(OnConnection)(IApplication* pApp, VARIANT_BOOL bFirstTime, long dwCookie, VARIANT_BOOL* bOnConnection);
  49.     STDMETHOD(OnDisconnection)(VARIANT_BOOL bLastTime);
  50.  
  51. // IApplicationEvents methods
  52. public:
  53.     STDMETHOD(BeforeBuildStart)();
  54.     STDMETHOD(BuildFinish)(long nNumErrors, long nNumWarnings);
  55.     STDMETHOD(BeforeApplicationShutDown)();
  56.     STDMETHOD(DocumentOpen)(IDispatch *pDocument);
  57.     STDMETHOD(BeforeDocumentClose)(IDispatch *pDocument);
  58.     STDMETHOD(DocumentSave)(IDispatch *pDocument);
  59.     STDMETHOD(NewDocument)(IDispatch *pDocument);
  60.     STDMETHOD(WindowActivate)(IDispatch *pWindow);
  61.     STDMETHOD(WindowDeactivate)(IDispatch *pWindow);
  62.     STDMETHOD(WorkspaceOpen)();
  63.     STDMETHOD(WorkspaceClose)();
  64.     STDMETHOD(NewWorkspace)();
  65.  
  66. // IDebuggerEvents method
  67. public:
  68.     STDMETHOD(BreakpointHit)(IDispatch *pBreakpoint);
  69.  
  70. // IBrkPnts
  71. public:
  72.     void GetCounts(long &lTotal, long &lEnabled);
  73.     void SetFile(LPCTSTR szFile);
  74.     void SetSaveOnlyEnabled(BOOL fSaveOnlyEnabled);
  75.     HRESULT ClearAll();
  76.     HRESULT FindDoc(LPCTSTR szFile, CComPtr<IGenericDocument>& pDoc, BOOL fOkToOpen = TRUE);
  77.     HRESULT Save(BOOL fToOutputWindow, LPCTSTR szFile, BOOL fSaveOnlyEnabled, CString& strComment);
  78.     HRESULT Load(LPCTSTR szFile, CString& strComment);
  79.     STDMETHOD(BrkPntMgr)();
  80. protected:
  81.     BOOL    m_fSaveOnlyEnabled;
  82.     CString    m_strFile;
  83.     BOOL    m_fOutputWnd;
  84.  
  85. };
  86.  
  87. #endif //__BRKPNTS_H_
  88.