提问:
在网页里用的时候需要知道他的classid
我在代码中看到有
const GUID CDECL BASED_CODE _tlid = { 0x89201950, 0x2CAC, 0x4CF7, { 0x99, 0x8, 0x73, 0x38, 0x61, 0x41, 0xEF, 0xD2 } };
这个,可别人的都是10进制的啊?
#include <olectl.h> #include <idispids.h> [ uuid(89201950-2CAC-4CF7-9908-73386141EFD2), version(1.0), helpfile("activex.hlp"), helpstring("activex ActiveX Control module"), control ] library activexLib { importlib(STDOLE_TLB); // Primary dispatch interface for CactivexCtrl [ uuid(88F1FDE7-7BD4-48FD-9D0C-6C2AEA01D7FC), helpstring("Dispatch interface for activex Control")] dispinterface _Dactivex { properties: methods: [id(DISPID_ABOUTBOX)] void AboutBox(); }; // Event dispatch interface for CactivexCtrl [ uuid(8DE3C33B-2B0B-4669-A636-B6FD893DF39F), helpstring("Event interface for activex Control") ] dispinterface _DactivexEvents { properties: // Event interface has no properties methods: }; // Class information for CactivexCtrl [ uuid(5161E46C-C157-4BC7-9DB7-7597617722F0), helpstring("activex Control"), control ] coclass activex { [default] dispinterface _Dactivex; [default, source] dispinterface _DactivexEvents; }; };
这么多 哪个才是?
回答:
[ uuid(5161E46C-C157-4BC7-9DB7-7597617722F0),
helpstring("activex Control"), control ]
coclass activex
-----------------------------------
5161E46C-C157-4BC7-9DB7-7597617722F0这个就是,其实就是C++ MFC项目中生成的idl文件中的最后一个GUID
然后在web中调用如下,即可:
<object id="activex" classid="clsid:5161E46C-C157-4BC7-9DB7-7597617722F0"></object>