home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / dbmsg / mapi / command.ext / cmdext.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-11  |  4.6 KB  |  149 lines

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. //  File Name 
  4. //      CMDEXT.H
  5. //
  6. //  Description
  7. //      Interface Methods are declared in this file for cmdext.cpp.
  8. //
  9. //  Author
  10. //      Gary Peluso
  11. //
  12. //  Revision: 1.00
  13. //
  14. // Written for Microsoft Windows Developer Support
  15. // Copyright (c) 1992-1995 Microsoft Corporation. All rights reserved.
  16. //
  17. #ifndef _CMDEXT_H_
  18. #define _CMDEXT_H_
  19.  
  20. #include <WINDOWS.H> 
  21. #include <COMMCTRL.H>
  22. #include <MAPIX.H>
  23. #include <MAPIUTIL.H>
  24. #include <MAPIFORM.H>
  25. #include <INITGUID.H>
  26. #include <MAPIGUID.H>
  27. #include <EXCHEXT.H>
  28.  
  29. #include "RESOURCE.H"
  30.  
  31. ///////////////////////////////////////////////////////////////////////////////
  32. //    prototypes
  33. void GetFolderStats(LPMAPIFOLDER lpFolder, ULONG FAR * ulSubFolders, 
  34.                     ULONG FAR * ulReadMsgs, ULONG FAR * ulUnReadMsgs);
  35.  
  36. ///////////////////////////////////////////////////////////////////////////////
  37. //    forward declarations
  38. class MyExchExt;
  39. class MyExchExtCommands;
  40. class MyExchExtUserEvents;
  41.  
  42. extern "C"
  43. {
  44.     LPEXCHEXT CALLBACK ExchEntryPoint(void);
  45. }
  46.  
  47. class MyExchExt : public IExchExt
  48. {
  49.  
  50.  public:
  51.     MyExchExt ();
  52.     STDMETHODIMP QueryInterface
  53.                     (REFIID                     riid,
  54.                      LPVOID *                   ppvObj);
  55.     inline STDMETHODIMP_(ULONG) AddRef
  56.                     () { ++m_cRef; return m_cRef; };
  57.     inline STDMETHODIMP_(ULONG) Release
  58.                     () { ULONG ulCount = --m_cRef;
  59.                          if (!ulCount) { delete this; }
  60.                          return ulCount;};
  61.     STDMETHODIMP Install (LPEXCHEXTCALLBACK pmecb, 
  62.                         ULONG mecontext, ULONG ulFlags);
  63.  
  64.  private:
  65.     ULONG m_cRef;
  66.     UINT  m_context;
  67.  
  68.     MyExchExtCommands * m_pExchExtCommands;
  69.     MyExchExtUserEvents * m_pExchExtUserEvents;
  70. };
  71.  
  72. class MyExchExtCommands : public IExchExtCommands
  73. {
  74.  public:
  75.     MyExchExtCommands () 
  76.         { m_cRef = 0; m_context = 0; 
  77.           m_cmdid = 0;  m_itbb = 0; m_itbm = 0;  m_hWnd = 0; };
  78.     STDMETHODIMP QueryInterface
  79.                     (REFIID                     riid,
  80.                      LPVOID *                   ppvObj);
  81.     inline STDMETHODIMP_(ULONG) AddRef
  82.                     () { ++m_cRef; return m_cRef; };
  83.     inline STDMETHODIMP_(ULONG) Release
  84.                     () { ULONG ulCount = --m_cRef;
  85.                          if (!ulCount) { delete this; }
  86.                          return ulCount;};
  87.     STDMETHODIMP InstallCommands(LPEXCHEXTCALLBACK pmecb, 
  88.                                 HWND hwnd, HMENU hmenu,
  89.                                 UINT FAR * cmdidBase, LPTBENTRY lptbeArray,
  90.                                 UINT ctbe, ULONG ulFlags);                                                                              
  91.     STDMETHODIMP DoCommand(LPEXCHEXTCALLBACK pmecb, UINT mni);
  92.     STDMETHODIMP_(VOID) InitMenu(LPEXCHEXTCALLBACK pmecb);
  93.     STDMETHODIMP Help(LPEXCHEXTCALLBACK pmecb, UINT mni);
  94.     STDMETHODIMP QueryHelpText(UINT mni, ULONG ulFlags, LPTSTR sz, UINT cch);
  95.     STDMETHODIMP QueryButtonInfo(ULONG tbid, UINT itbb, LPTBBUTTON ptbb,
  96.                                 LPTSTR lpsz, UINT cch, ULONG ulFlags);
  97.     STDMETHODIMP ResetToolbar(ULONG tbid, ULONG ulFlags);
  98.  
  99.     inline VOID SetContext
  100.                 (ULONG eecontext) { m_context = eecontext; };
  101.     inline UINT GetCmdID() { return m_cmdid; };
  102.   
  103.  private:
  104.     ULONG m_cRef;
  105.     ULONG m_context;
  106.  
  107.     UINT  m_cmdid;     // cmdid for menu extension command
  108.  
  109.     UINT  m_itbb;      // toolbar
  110.     UINT  m_itbm;
  111.  
  112.     HWND  m_hWnd;          
  113.  
  114. };
  115.  
  116.  
  117. class MyExchExtUserEvents : public IExchExtUserEvents
  118. {
  119.  public:
  120.     MyExchExtUserEvents() { m_cRef = 0; m_context = 0;
  121.                             m_pExchExt = NULL; };
  122.     STDMETHODIMP QueryInterface
  123.                 (REFIID                     riid,
  124.                  LPVOID *                   ppvObj);
  125.     inline STDMETHODIMP_(ULONG) AddRef
  126.                 () { ++m_cRef; return m_cRef; };
  127.     inline STDMETHODIMP_(ULONG) Release
  128.                 () { ULONG ulCount = --m_cRef;
  129.                      if (!ulCount) { delete this; }
  130.                      return ulCount;};
  131.  
  132.     STDMETHODIMP_(VOID) OnSelectionChange(LPEXCHEXTCALLBACK pmecb);
  133.     STDMETHODIMP_(VOID) OnObjectChange(LPEXCHEXTCALLBACK pmecb);
  134.  
  135.     inline VOID SetContext
  136.                 (ULONG eecontext) { m_context = eecontext; };
  137.     inline VOID SetIExchExt
  138.                 (MyExchExt * pExchExt) { m_pExchExt = pExchExt; };
  139.  
  140.  private:
  141.     ULONG m_cRef;
  142.     ULONG m_context;
  143.     
  144.     MyExchExt * m_pExchExt;
  145.  
  146. };
  147.  
  148. #endif // _CMDEXT_H_
  149.