0
IAutomation - 如何獲取其順利通過指針參數的值?IAutomation - 如何獲取其順利通過指針參數的值?
在.idl文件所著:
interface IAutomation : IDispatch {
[id(0x000000e0), helpstring("Returns if the player is ready. Many of the other commands fail as long as the player is not ready.")]
HRESULT GetReady([out] VARIANT* Ready);
};
我想,GETREADY() - 方法,而不是財產。
如果我想使用田鼠庫:
object player = object::create("StereoPlayer.Automation", CLSCTX_LOCAL_SERVER, vole::coercion_level::valueCoercion);
VARIANT var;
::VariantInit(&var);
VARIANT pos = player.invoke_method(vole::of_type<VARIANT>(), L"GetReady", var);
但收到鏈接錯誤:
error LNK2019: unresolved external symbol "public: static struct tagVARIANT __cdecl vole::com_return_traits<struct tagVARIANT>::convert(struct tagVARIANT const &,enum vole::coercion_level::coercion_level)" ([email protected][email protected]@@@[email protected]@[email protected]@[email protected][email protected]@@Z) referenced in function "public: struct tagVARIANT __thiscall vole::object::invoke_method<struct tagVARIANT,struct tagVARIANT>(struct vole::of_type<struct tagVARIANT>,unsigned short const *,struct tagVARIANT const &)" ([email protected]@@[email protected]@[email protected]@@[email protected]@[email protected]@@@[email protected]@@Z)
調用其他方法,它返回任何結果,完美的作品。
另外我嘗試直接調用方法IDispatch :: Invoke(),如How To Use Visual C++ to Access DocumentProperties with Automation 中所述。但誤解了如何回報價值。
如果調用不帶參數的invoke_method - invoke()返回hr = 0x8002000e參數個數無效。 – Peleron