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.

93 lines
2.7 KiB

  1. /*++
  2. Copyright (c) 1999-2000 Microsoft Corporation
  3. Module Name:
  4. RDSHostCP.h
  5. Abstract:
  6. Wizard-generated code for invoking server-side event sink functions.
  7. I added the "scriptDisp" field. If it is non-NULL, then its default method
  8. will be called along with any registered interfaces. This is to accomodate
  9. script clients that need to bind their event interfaces when the script
  10. engine initializes. Our objects are dynamically retrieved by the client
  11. script or application post-init.
  12. Author:
  13. Tad Brockway 02/00
  14. Revision History:
  15. --*/
  16. #ifndef _RDSHOSTCP_H_
  17. #define _RDSHOSTCP_H_
  18. template <class T>
  19. class CProxy_ISAFRemoteDesktopSessionEvents : public IConnectionPointImpl<T, &DIID__ISAFRemoteDesktopSessionEvents, CComDynamicUnkArray>
  20. {
  21. public:
  22. VOID Fire_ClientConnected(IDispatch *scriptDisp=NULL)
  23. {
  24. T* pT = static_cast<T*>(this);
  25. int nConnectionIndex;
  26. int nConnections = m_vec.GetSize();
  27. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  28. {
  29. pT->Lock();
  30. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  31. pT->Unlock();
  32. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  33. if (pDispatch != NULL)
  34. {
  35. DISPPARAMS disp = { NULL, NULL, 0, 0 };
  36. HRESULT hr = pDispatch->Invoke(DISPID_RDSSESSIONSEVENTS_CLIENTCONNECTED, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
  37. }
  38. }
  39. //
  40. // Invoke the scriptable IDispatch interface, if specified.
  41. //
  42. if (scriptDisp != NULL) {
  43. DISPPARAMS disp = { NULL, NULL, 0, 0 };
  44. HRESULT hr = scriptDisp->Invoke(0x0, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
  45. }
  46. }
  47. VOID Fire_ClientDisconnected(IDispatch *scriptDisp=NULL)
  48. {
  49. T* pT = static_cast<T*>(this);
  50. int nConnectionIndex;
  51. int nConnections = m_vec.GetSize();
  52. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  53. {
  54. pT->Lock();
  55. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  56. pT->Unlock();
  57. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  58. if (pDispatch != NULL)
  59. {
  60. DISPPARAMS disp = { NULL, NULL, 0, 0 };
  61. HRESULT hr = pDispatch->Invoke(DISPID_RDSSESSIONSEVENTS_CLIENTDISCONNECTED, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
  62. }
  63. }
  64. //
  65. // Invoke the scriptable IDispatch interface, if specified.
  66. //
  67. if (scriptDisp != NULL) {
  68. DISPPARAMS disp = { NULL, NULL, 0, 0 };
  69. HRESULT hr = scriptDisp->Invoke(0x0, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
  70. }
  71. }
  72. };
  73. #endif