ATL ActiveX 控件如何向 JavaScript 公开布尔值
我正在使用 ATL 创建 ActiveX 控件并尝试公开采用布尔值的属性。我实现它如下:
STDMETHOD(get_Visible)(VARIANT_BOOL *pVal);
STDMETHOD(put_Visible)(VARIANT_BOOL newVal);
在 JavaScript 函数中,我通过以下代码调用它:
MyAxCtl.Visible = true;
//MyAxCtl.Visible = "true";
//MyAxCtl.Visible = "TRUE";
//MyAxCtl.Visible = "VARIANT_TRUE";
//MyAxCtl.Visible = -1;
//MyAxCtl.Visible = "-1";
但是,它们都不起作用。所以,我的问题是如何将 ATL ActiveX 控件中的布尔值公开给 JavaScript。
此外,任何人都可以告诉我在哪里可以找到有关 ATL 类型和 JavaScript 类型之间通信的文档?我想找到可以暴露给 JavaScript 的 ATL 类型列表。
非常感谢, 舒品宁
I am creating an ActiveX control using ATL and trying to expose a property taking a Boolean value. I implemented it as below:
STDMETHOD(get_Visible)(VARIANT_BOOL *pVal);
STDMETHOD(put_Visible)(VARIANT_BOOL newVal);
In the JavaScript function, I call this by the following code:
MyAxCtl.Visible = true;
//MyAxCtl.Visible = "true";
//MyAxCtl.Visible = "TRUE";
//MyAxCtl.Visible = "VARIANT_TRUE";
//MyAxCtl.Visible = -1;
//MyAxCtl.Visible = "-1";
However, none of them works. So, my question is how to expose a Boolean value from ATL ActiveX control to JavaScript.
Moreover, anyone can tells me where can I find any document about communication between ATL types can JavaScript types? I want to find a list of ATL types that can be exposed to JavaScript.
Many thanks,
Shupining
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从您提供的代码来看,STDMETHOD 是正确的,并且对布尔值的正确 JavaScript 调用是将其设置为 true。
虽然我没有看到您发布的代码有任何问题,但请确保其“可见”而不是“可见”。
调试时是否输入了 ActiveX 调用?
From the code you provider the STDMETHOD's are correct and the proper JavaScript call for a Boolean is to set it to true.
While I don't see a case issue with the code you posted, make sure its "Visible" not "visisble".
When you debug is the ActiveX call being entered?