我写了一个测试网页
<BODY>
<OBJECT ID="test2" CLASSID="CLSID:D1413D1E-0868-4158-A556-9463E13F4B13"></OBJECT>
<OBJECT ID="test" CLASSID="CLSID:723531DF-C92C-44CB-BC14-49B9C917A594"></OBJECT>
<script>
test2.attachEvent("OnTest", Ontest2);
test.attachEvent("OnTest", Ontest);
test.test();
test2.test();
function Ontest2()
{
alert("test2");
}
function Ontest()
{
alert("test");
}
</script>
</BODY>
其中test2是用ATL建立的一个full control,Apartment模型,dual接口,支持连接点.
test是用ATL建立的一个simple object,Apartment模型,dual接口,支持连接点.
这两个对象都增加了事件OnTest,并且都在test方法中调用了Fire_OnTest();
但是网页运行的结果是只弹出对话框"test2".请问要怎样才能在用simple object的情况下使用事件
<BODY>
<OBJECT ID="test2" CLASSID="CLSID:D1413D1E-0868-4158-A556-9463E13F4B13"></OBJECT>
<OBJECT ID="test" CLASSID="CLSID:723531DF-C92C-44CB-BC14-49B9C917A594"></OBJECT>
<script>
test2.attachEvent("OnTest", Ontest2);
test.attachEvent("OnTest", Ontest);
test.test();
test2.test();
function Ontest2()
{
alert("test2");
}
function Ontest()
{
alert("test");
}
</script>
</BODY>
其中test2是用ATL建立的一个full control,Apartment模型,dual接口,支持连接点.
test是用ATL建立的一个simple object,Apartment模型,dual接口,支持连接点.
这两个对象都增加了事件OnTest,并且都在test方法中调用了Fire_OnTest();
但是网页运行的结果是只弹出对话框"test2".请问要怎样才能在用simple object的情况下使用事件
解决方案 »
- 今天运行VC是弹出了应用程序错误的窗口
- Win32编程 ActiveX控件的问题
- SetWindowsHookEx问题
- 如何能使控件显示颜色
- CBCGMenuBar做的菜单,怎样设置菜单Enable???
- Property or Method not supported by layers of this type.
- 网络防火墙是怎么写成的?
- 求:http://www.programsalon.com/(程序员联合开发网pudn)的帐户~~~~~~~~~~~~~~
- child对话框如何使用?
- 有关ActiveX的一个问题
- 求助:编译工程时,出现下面的错误,请各位大哥帮我看看,谢谢!
- CString与16进制整数的互换
IProvideClassInfo interfaces. This is done by deriving your control from the
default ATL implementation, IProvideClassInfo2Impl.
1. Add the following line to your class derivation list:
public IProvideClassInfo2Impl<&CLSID_<object_name>, NULL,
&LIBID_<project_name>Lib>
2. Add the following lines to your COM_MAP:
COM_INTERFACE_ENTRY(IProvideClassInfo)
COM_INTERFACE_ENTRY(IProvideClassInfo2)
Hope that helps. For additional information you can take a look at KB Q200839