Share via


How to Apply Registry Setting Changes to Open Instances of Internet Explorer Embedded (Windows Embedded Compact 7)

When you develop an application that runs on Windows Embedded Compact 7, you may need your application to programmatically change the Internet Explorer Embedded registry settings. You can apply the new settings without the user having to restart the web browser by adding a couple extra lines of code. The following code examples show you how you can change the location of the Internet Explorer Embedded cache, cookies, or history at runtime.

In this article:

Default Registry Settings

Windows Embedded Compact 7 uses registry values to specify the directories in which the cache, history, and cookies are stored. The registry key for these values is HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders.

The following table shows the default path settings in the registry for the cache, cookies, and history values.

 Value Type   Default Path
 Cache  REG_SZ  \Windows\Profiles\guest\Temporary Internet Files
 Cookies  REG_SZ  \Windows\Profiles\guest\Cookies
 History  REG_SZ  \Windows\Profiles\guest\History

 

Changing the Registry Settings

In your application, after the code that modifies the registry, add the following two lines of code. This code notifies any instances of the web browser that are currently open that the settings have changed, and it then posts an update so that the rendering engine can reload its settings.

Important:
For readability, the following code example does not contain security checking or error handling. Do not use the following code in a production environment.
InternetSetOption( NULL,INTERNET_OPTION_SETTINGS_CHANGED,NULL,0 );
PostMessage( HWND_BROADCAST, WM_SETTINGCHANGE, 0, 0 );

 

For example, the following code changes the cache path to a directory called Temp:

Important:
For readability, the following code example does not contain security checking or error handling. Do not use the following code in a production environment.
HKEY myRegistryKey;

RegOpenKeyEx( HKEY_CURRENT_USER, TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders"),0,0,&myRegistryKey );
RegSetValueEx( myRegistryKey, TEXT("Cache"),0, REG_SZ, (LPBYTE)TEXT("\\Temp"), sizeof(TCHAR) * sizeof(TEXT("\\Temp")) );
RegCloseKey( myRegistryKey );

InternetSetOption( NULL,INTERNET_OPTION_SETTINGS_CHANGED,NULL,0 );
PostMessage( HWND_BROADCAST, WM_SETTINGCHANGE, 0, 0 );

The user does not need to close and reopen the web browser for the preceding changes to take effect.

When you’re modifying the registry, it may also be helpful for you to see how the code for the Internet Options Control Panel item interacts with Internet Explorer Embedded registry settings. This source code is in %_WINCEROOT%\public\ie7\oak\inetcpl.


Community Resources


See Also