Source code of Windows XP (NT5)
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.

69 lines
2.6 KiB

  1. // esh.h: interface for the CEventScriptHandler class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #if !defined(AFX_EVENTSCRIPTHANLDER_H__300C7F54_FE1E_11D0_A776_00C04FC2F5B3__INCLUDED_)
  5. #define AFX_EVENTSCRIPTHANLDER_H__300C7F54_FE1E_11D0_A776_00C04FC2F5B3__INCLUDED_
  6. #if _MSC_VER >= 1000
  7. #pragma once
  8. #endif // _MSC_VER >= 1000
  9. //
  10. // CEventScriptHandler - Use or derive from this class to create a script
  11. // handler for a specific sink.
  12. //
  13. // Usage: Use SetScript to pass the script to the script handler. You can
  14. // make global variables available to your script by calling AddGlobalVariable.
  15. // Use AddConnectionPoint to bind to specific functions within the script.
  16. // Name the connection point Hello and the script parse will look for Hello_xxx
  17. // functions and attempt to connect to them. Once you have set the script and
  18. // any other options, you can call StartScript to cause the script to be loaded,
  19. // parsed and intialized. Any global code in the script will be executed at this
  20. // time. Use ExecuteConnectionPoint to cause a specific function to be executed.
  21. //
  22. class CEventScriptHandler
  23. {
  24. public:
  25. CEventScriptHandler();
  26. virtual ~CEventScriptHandler();
  27. // set the script to be executed
  28. STDMETHOD(SetScript)(IStream* pstmScript);
  29. STDMETHOD(SetScript)(BSTR bstrFileName);
  30. // sets the maximum execution time for the script
  31. STDMETHOD(MaxExecutionTime)(DWORD dwMaxExecutionTime);
  32. // tells the script engine whether to allow CreateObject calls
  33. STDMETHOD(AllowCreateObject)(BOOL fCreateObjectAllowed);
  34. // tells the script parser that the script uses ASPSyntax
  35. STDMETHOD(ASPSyntax)(BOOL fIsASPSyntax);
  36. // adds a connnection point
  37. STDMETHOD(AddConnectionPoint)(BSTR bstrName, IConnectionPointContainer* pContainer);
  38. // adds a global variable
  39. STDMETHOD(AddGlobalVariable)(BSTR bstrName, VARIANT varVariable);
  40. // Initializes the script engine, parses the scripts and resolves
  41. // all connection points. Requires that SetScript be called first.
  42. // Above functions must be called before StartScript for them to
  43. // affect script execution.
  44. STDMETHOD(StartScript)(void);
  45. // stops the script
  46. STDMETHOD(StopScript)(void);
  47. // stops and starts the script
  48. STDMETHOD(RestartScript)(void);
  49. // causes a specific script function to be executed
  50. STDMETHOD(ExecuteConnectionPoint)(IConnectionPoint* pConnectionPoint, DISPID dispid);
  51. protected:
  52. VARIANT m_varScriptResponse;
  53. VARIANT m_varErrorResponse;
  54. IScripto* m_pScripto;
  55. ULONG m_cNamedProps;
  56. IPropertyBag* m_pBag;
  57. private:
  58. BOOL m_fScriptStopped;
  59. };
  60. #endif // !defined(AFX_EVENTSCRIPTHANLDER_H__300C7F54_FE1E_11D0_A776_00C04FC2F5B3__INCLUDED_)