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.

43 lines
1.5 KiB

  1. // Copyright (c) 1999 Microsoft Corporation. All rights reserved.
  2. //
  3. // Standard included stuff for the AudioVBScript engine.
  4. //
  5. #pragma once
  6. #include "oleaut.h"
  7. const LCID lcidUSEnglish = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT);
  8. const bool g_fUseOleAut = false;
  9. // Constants built into the langauge. These will be treated as global variables and given fixed values.
  10. extern const char *g_rgszBuiltInConstants[];
  11. extern const int g_cBuiltInConstants;
  12. // Helpers for working with IDispatch
  13. DISPID GetDispID(IDispatch *pIDispatch, const char *pszBase); // returns DISPID_UNKNOWN on failure.
  14. HRESULT InvokeAttemptingNotToUseOleAut(
  15. IDispatch *pDisp,
  16. DISPID dispIdMember,
  17. WORD wFlags,
  18. DISPPARAMS *pDispParams,
  19. VARIANT *pVarResult,
  20. EXCEPINFO *pExcepInfo,
  21. UINT *puArgErr);
  22. HRESULT SetDispatchProperty(IDispatch *pDisp, DISPID dispid, bool fSetRef, const VARIANT &v, EXCEPINFO *pExcepInfo);
  23. HRESULT GetDispatchProperty(IDispatch *pDisp, DISPID dispid, VARIANT &v, EXCEPINFO *pExcepInfo);
  24. void ConvertOleAutExceptionBSTRs(bool fCurrentlyUsesOleAut, bool fResultUsesOleAut, EXCEPINFO *pExcepInfo);
  25. // Holds a variant value. Inits it on construction and clears it on destruction. Any failure on clearing is ignored.
  26. class SmartVariant
  27. {
  28. public:
  29. SmartVariant() { DMS_VariantInit(g_fUseOleAut, &m_v); }
  30. ~SmartVariant() { DMS_VariantClear(g_fUseOleAut, &m_v); }
  31. operator VARIANT &() { return m_v; }
  32. VARIANT *operator &() { return &m_v; }
  33. private:
  34. VARIANT m_v;
  35. };