Why doesn't implementing IObjectSafety make a difference?

戏子无情 提交于 2019-12-23 19:52:48

问题


we have an activex object which implements IObjectSafety to indicate that it is safe for scripting. It installs from a trusted site. but we still get the IE complaint that the control on this page is not safe for scripting.

The admins for the site that are running our activex are reluctant to enable controls not marked safe for scripting even though its the trusted zone.

our cab and all its components are signed (we finally made the uverified publisher go away by signing every dll that went into the msi installer)

anybody have any thoughts on how to bludgeon IObjectSafety into working?


回答1:


Make sure that you are using the correct GUID for IObjectSafety. Your interface should look like this, with the specific GUID:

[ComImport]
// This GUID matters!
[Guid("CB5BDC81-93C1-11CF-8F20-00805F2CD064")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IObjectSafety
{
    [PreserveSig]
    int GetInterfaceSafetyOptions(ref Guid riid, out int pdwSupportedOptions, out int pdwEnabledOptions);

    [PreserveSig]
    int SetInterfaceSafetyOptions(ref Guid riid, int dwOptionsMask, int dwEnabledOptions);
}

There are a few links out there that outline how to implement IObjectSafety, but here's the only one I found that calls out the fact that the Guid matters. After making that change in my code, IE no longer complained.



来源:https://stackoverflow.com/questions/8423672/why-doesnt-implementing-iobjectsafety-make-a-difference

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!