WordEventSink.h
上传用户:fda_625
上传日期:2007-01-02
资源大小:32k
文件大小:2k
源码类别:

文件操作

开发平台:

Visual C++

  1. #if !defined(AFX_WORDEVENTSINK_H__F45A8330_C1E9_11D2_A0C4_0080C7F3B56B__INCLUDED_)
  2. #define AFX_WORDEVENTSINK_H__F45A8330_C1E9_11D2_A0C4_0080C7F3B56B__INCLUDED_
  3. /*----------------------------------------------------------------------------*/
  4. #if _MSC_VER > 1000
  5. #pragma once
  6. #endif // _MSC_VER > 1000
  7. /*----------------------------------------------------------------------------*/
  8. #pragma warning (disable:4146)
  9. #import "mso97.dll"
  10. #pragma warning (default:4146)
  11. #import "vbeext1.olb"
  12. #import "msword8.olb" rename("ExitWindows", "WordExitWindows")
  13. #include "ConnectionAdvisor.h"
  14. class CTestDlg;
  15. /*----------------------------------------------------------------------------*/
  16. const IID IID_IWordAppEventSink = __uuidof(Word::ApplicationEvents);
  17. const IID IID_IWordDocEventSink = __uuidof(Word::DocumentEvents);
  18. /*----------------------------------------------------------------------------*/
  19. class CWordEventSink : public CCmdTarget
  20. {
  21. DECLARE_DYNCREATE(CWordEventSink)
  22. public:
  23. CWordEventSink();
  24. virtual ~CWordEventSink();
  25. BOOL Advise(IUnknown* pSource, REFIID iid);
  26. BOOL Unadvise(REFIID iid);
  27. void SetLauncher(CTestDlg* pWordLauncher);
  28. // ClassWizard generated virtual function overrides
  29. //{{AFX_VIRTUAL(CWordEventSink)
  30. public:
  31. virtual void OnFinalRelease();
  32. //}}AFX_VIRTUAL
  33. protected:
  34. // Generated message map functions
  35. //{{AFX_MSG(CWordEventSink)
  36. // NOTE - the ClassWizard will add and remove member functions here.
  37. //}}AFX_MSG
  38. DECLARE_MESSAGE_MAP()
  39. // Generated OLE dispatch map functions
  40. //{{AFX_DISPATCH(CWordEventSink)
  41. afx_msg void OnAppStartup();
  42. afx_msg void OnAppQuit();
  43. afx_msg void OnAppDocumentChange();
  44. afx_msg void OnDocNew();
  45. afx_msg void OnDocOpen();
  46. afx_msg void OnDocClose();
  47. //}}AFX_DISPATCH
  48. DECLARE_DISPATCH_MAP()
  49. DECLARE_INTERFACE_MAP()
  50. private:
  51. CConnectionAdvisor m_AppEventsAdvisor;
  52. CConnectionAdvisor m_DocEventsAdvisor;
  53. CTestDlg* m_pWordLauncher;
  54. };
  55. /////////////////////////////////////////////////////////////////////////////
  56. //{{AFX_INSERT_LOCATION}}
  57. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  58. #endif // !defined(AFX_WORDEVENTSINK_H__F45A8330_C1E9_11D2_A0C4_0080C7F3B56B__INCLUDED_)