Howto: reset IE security zone settings programmatically#
Internet Explorer 7 introduced the IInternetZoneManagerEx2 interface, which has a FixUnsecureSettings method to reset all security zone settings. Like all other IInternetZoneManager* interfaces, you can query this interface from the internet zone manager object:
IInternetZoneManagerEx2* pzoneManager=NULL;
HRESULT hr=CoCreateInstance(CLSID_InternetZoneManager
,NULL,CLSCTX_INPROC_SERVER,IID_IInternetZoneManagerEx2,(LPVOID*)&pzoneManager);
if(hr==S_OK && pzoneManager!=NULL) {
hr=pzoneManager->FixUnsecureSettings();
}
There’s another CoInternetCreateZoneManager function to get the zone manager object’s IInternetZoneManager interface.
What’s new in MFC/ATL 11 Beta
Add the correct interface first in Adding an MFC Class from an ActiveX Control wizard.