Implementing "Internet Options" in Internet Explorer

Here is some sample code that will invoke the "Internet Options" control panel applet. This dialog is the same one that is available via IE's View / Internet Options... menu selection.

Using the ClassWizard, select the "Add Class..." button. Select "From a type library...". Browse to the systems 32 directory and select SHDocVw.dll. Select the IShellDispatch item and click on OK. This will add two files to your project, shdocvw.cpp and shdocvw.h Include shdocvw.h in the source file which is invoking the internet options. Include Initguid.h in the source file which is invoking the internet options.Define the GUID for the shell class:

DEFINE_GUID(CLSID_Shell,0x13709620,0xc279,0x11ce,0xa4,0x9e,0x44,0x45,0x53,0x54,0x00,0x00);

and some code to actually invoke the control panel applet...

IShellDispatch disp;
HRESULT sc;
sc = ::CoInitialize(NULL);
if (FAILED (sc))
{
	CString str;
	str.Format(_T("Failed to Initialize."));
	TRACE( str) ;
	return;
}

sc = ::CoCreateInstance( CLSID_Shell, NULL, CLSCTX_SERVER,
IID_IDispatch, (void**)&disp ) ;
if (FAILED (sc))
{
	CString str;
	str.Format(_T("Failed to create Instance :-( "));
	TRACE( str) ;
	return;
}

disp.ControlPanelItem("inetcpl.cpl");	
These steps and code have been tested by starting with a new MFC app wizard dialog based application.

Last updated: December 6, 1998