使atl开发的activex控件不弹脚本安全提示

1.在头文件加入:

COM_INTERFACE_ENTRY(IObjectSafety)

public:
 //IObjectSafetyImpl
 STDMETHOD(GetInterfaceSafetyOptions)(REFIID riid, DWORD *pdwSupportedOptions, DWORD *pdwEnabledOptions);
 STDMETHOD(SetInterfaceSafetyOptions)(REFIID riid, DWORD dwOptionSetMask, DWORD dwEnabledOptions);

2.在cpp文件加入:

STDMETHODIMP xxxx::GetInterfaceSafetyOptions(REFIID riid, DWORD *pdwSupportedOptions, DWORD *pdwEnabledOptions)
{
 *pdwSupportedOptions = INTERFACESAFE_FOR_UNTRUSTED_CALLER|INTERFACESAFE_FOR_UNTRUSTED_DATA;
 *pdwEnabledOptions = *pdwSupportedOptions;
 return S_OK;
}

STDMETHODIMP xxxx::SetInterfaceSafetyOptions(REFIID riid, DWORD dwOptionSetMask, DWORD dwEnabledOptions)
{
 return S_OK;
}

 

你可能感兴趣的:(脚本,interface)