?????????????IE?????????
??????????????IEδ??????????????ActiveX????????IE??????????迪??????ActiveX?????????IE????????棺
?????????? ActiveX ?????????????? ?????????????????????????????
?????????????????????IE?????????????????????????????????IE????????????????????????IE??????ж????ActiveX?????????????μ?Microsoft??????????????
????http://support.microsoft.com/kb/216434/en-us
????There are two ways to mark a control as safe for scripting and initialization:
????Implement the IObjectSafety interface.
????Provide the following registry keys for the control's CLSID under the Implemented Categories section:
????The following key marks the control safe for scripting:
????{7DD95801-9882-11CF-9FA9-00AA006C42C4}
????The following key marks the control safe for initialization from persistent data:
????{7DD95802-9882-11CF-9FA9-00AA006C42C4}
????Microsoft recommends that you implement IObjectSafety to mark a control as safe or unsafe. This prevents other users from repackaging your control and marking it as safe when it is not.
????????????IObjectSafety???????IE????ActiveX?????????????????????δ?????????????????д??
????IObjectSafety?????COM?μ????????C++?????????????????????????.NET???????????????????????£??????ActiveX??????????????????COM????????????C#???????????COM????
?????????????????COM?????????????COM???????????????????????????????????????COM?????????????????????÷?????????????.NET Framework???ComInterfaceType??????????????壺
namespace System.Runtime.InteropServices
{
// ??:
//     Identifies how to expose an interface to COM.
[Serializable]
[ComVisible(true)]
public enum ComInterfaceType
{
// ??:
//     Indicates the interface is exposed to COM as a dual interface?? which enables
//     both early and late binding. System.Runtime.InteropServices.ComInterfaceType.InterfaceIsDual
//     is the default value.
InterfaceIsDual = 0??
//
// ??:
//     Indicates an interface is exposed to COM as an IUnknown -derived interface??
//     which enables only early binding.
InterfaceIsIUnknown = 1??
//
// ??:
//     Indicates an interface is exposed to COM as a dispinterface?? which enables
//     late binding only.
InterfaceIsIDispatch = 2??
}
}
?????????????????????????????ο???C#??????????桷28.1.3 ????
??????MSDN?????????????IObjectSafety?????IUnknown?????????????????????????????????COM??????????????Guid???CLSID??????????е?C#?????????COM?У???????????????Guid?????????????IID??typelib id??
???????????????C#??д????????????COM???IID???????????????COM???????????????Microsoft?????????IObjectSafety???壺
????IObjectSafety???壺
[
uuid(C67830E0-D11D-11cf-BD80-00AA00575603)??
helpstring("VB IObjectSafety Interface")??
version(1.0)
]
library IObjectSafetyTLB
{
importlib("stdole2.tlb");
[
uuid(CB5BDC81-93C1-11cf-8F20-00805F2CD064)??
helpstring("IObjectSafety Interface")??
odl
]
interface IObjectSafety:IUnknown {
[helpstring("GetInterfaceSafetyOptions")]
HRESULT GetInterfaceSafetyOptions(
[in] long riid??
[in] long *pdwSupportedOptions??
[in] long *pdwEnabledOptions);
[helpstring("SetInterfaceSafetyOptions")]
HRESULT SetInterfaceSafetyOptions(
[in] long riid??
[in] long dwOptionsSetMask??
[in] long dwEnabledOptions);
}
}
???????е?uuid(CB5BDC81-93C1-11cf-8F20-00805F2CD064)?????????IID??