Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
2.1 KiB

  1. /*
  2. SessEvnt.h
  3. */
  4. #ifndef __SESSEVNT__
  5. #define __SESSEVNT__
  6. #include "Shared.h"
  7. class ATL_NO_VTABLE CSessionEvent :
  8. public CComObjectRootEx<CComSingleThreadModel>,
  9. public IDispEventImpl<IDC_SessionEvent, CSessionEvent, &DIID_DMsgrSessionEvents, &LIBID_MsgrSessionManager, 1, 0>
  10. {
  11. public:
  12. CSessionEvent()
  13. {
  14. m_pSessObj = NULL; m_pIMSession = NULL;
  15. }
  16. ~CSessionEvent()
  17. {
  18. if (m_pSessObj)
  19. {
  20. DispEventUnadvise(m_pSessObj);
  21. m_pSessObj->Release();
  22. }
  23. }
  24. DECLARE_PROTECT_FINAL_CONSTRUCT()
  25. BEGIN_COM_MAP(CSessionEvent)
  26. END_COM_MAP()
  27. BEGIN_SINK_MAP(CSessionEvent)
  28. SINK_ENTRY_EX(IDC_SessionEvent, DIID_DMsgrSessionEvents, DISPID_ONAPPNOTPRESENT, OnAppNotPresent)
  29. SINK_ENTRY_EX(IDC_SessionEvent, DIID_DMsgrSessionEvents, DISPID_ONACCEPTED, OnAccepted)
  30. SINK_ENTRY_EX(IDC_SessionEvent, DIID_DMsgrSessionEvents, DISPID_ONDECLINED, OnDeclined)
  31. SINK_ENTRY_EX(IDC_SessionEvent, DIID_DMsgrSessionEvents, DISPID_ONTERMINATION, OnTermination)
  32. SINK_ENTRY_EX(IDC_SessionEvent, DIID_DMsgrSessionEvents, DISPID_ONREADYTOLAUNCH, OnReadyToLaunch)
  33. SINK_ENTRY_EX(IDC_SessionEvent, DIID_DMsgrSessionEvents, DISPID_ONCONTEXTDATA, OnContextData)
  34. SINK_ENTRY_EX(IDC_SessionEvent, DIID_DMsgrSessionEvents, DISPID_ONCANCELLED, OnCancelled)
  35. END_SINK_MAP()
  36. public:
  37. void Init(CIMSession* pIM, IMsgrSession *pS)
  38. {
  39. if (m_pSessObj)
  40. {
  41. DispEventUnadvise(m_pSessObj);
  42. m_pSessObj->Release();
  43. }
  44. m_pIMSession = pIM;
  45. m_pSessObj = pS;
  46. m_pSessObj->AddRef();
  47. DispEventAdvise(m_pSessObj);
  48. };
  49. private:
  50. IMsgrSession* m_pSessObj;
  51. CIMSession* m_pIMSession;
  52. void __stdcall OnAppNotPresent(BSTR bstrAppName, BSTR bstrAppURL);
  53. void __stdcall OnAccepted(BSTR bstrAppData);
  54. void __stdcall OnDeclined(BSTR bstrAppData);
  55. void __stdcall OnTermination(long hr, BSTR bstrAppData);
  56. void __stdcall OnReadyToLaunch();
  57. void __stdcall OnContextData(BSTR pBlob);
  58. void __stdcall OnCancelled(BSTR bstrAppData);
  59. };
  60. #endif // __SESSEVNT__