::SendMessage( HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM)"Software\\Clients\\StartMenuInternet" );
::SendMessageTimeout( HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM)MOZ_CLIENT_BROWSER_KEY, SMTO_NORMAL|SMTO_ABORTIFHUNG, MOZ_HWND_BROADCAST_MSG_TIMEOUT, NULL);
static void setWindowsXP() {    // We test for the presence of this subkey as a WindowsXP test.    // We do it this way so that vagueries of future Windows versions    // are handled as best we can.    HKEY key;    nsCAutoString baseKey( NS_LITERAL_CSTRING( "Software\\Clients\\StartMenuInternet" ) );    LONG rc = ::RegOpenKey( HKEY_LOCAL_MACHINE, baseKey.get(), &key );    if ( rc == ERROR_SUCCESS ) {        // OK, this is WindowsXP (or equivalent).  Add this application to the        // set registered as "Start Menu internet apps."  These entries go        // under the subkey MOZILLA.EXE (or whatever the name of this executable is),        // that subkey name is generated by the utility function shortAppName.        if ( rc == ERROR_SUCCESS ) {            // The next 3 go under this subkey.            nsCAutoString subkey( baseKey + NS_LITERAL_CSTRING( "\\" ) + shortAppName() );            // Pretty name.  This goes into the LocalizedString value.  It is the            // name of the executable (preceded by '@'), followed by ",-nnn" where            // nnn is the resource identifier of the string in the .exe.  That value            // comes from nsINativeAppSupportWin.h.            char buffer[ _MAX_PATH + 8 ]; // Path, plus '@', comma, minus, and digits (5)            _snprintf( buffer, sizeof buffer, "@%s,-%d", thisApplication().get(), IDS_STARTMENU_APPNAME );            RegistryEntry( HKEY_LOCAL_MACHINE,                            subkey.get(),                           "LocalizedString",                            buffer ).set();            // Default icon (from .exe resource).            RegistryEntry( HKEY_LOCAL_MACHINE,                            nsCAutoString( subkey + NS_LITERAL_CSTRING( "\\DefaultIcon" ) ).get(),                           "",                            nsCAutoString( thisApplication() + NS_LITERAL_CSTRING( ",0" ) ).get() ).set();            // Command to open.            RegistryEntry( HKEY_LOCAL_MACHINE,                           nsCAutoString( subkey + NS_LITERAL_CSTRING( "\\shell\\open\\command" ) ).get(),                           "",                            thisApplication().get() ).set();            // "Properties" verb.  The default value is the text that will appear in the menu.            // The default value under the command subkey is the name of this application, with            // arguments to cause the Preferences window to appear.            nsCOMPtr<nsIStringBundleService> bundleService( do_GetService( "@mozilla.org/intl/stringbundle;1" ) );            nsCOMPtr<nsIStringBundle> bundle;            nsXPIDLString label;            if ( bundleService &&                 NS_SUCCEEDED( bundleService->CreateBundle( "chrome://global-platform/locale/nsWindowsHooks.properties",                                                       getter_AddRefs( bundle ) ) ) &&                 NS_SUCCEEDED( bundle->GetStringFromName( NS_LITERAL_STRING( "prefsLabel" ).get(), getter_Copies( label ) ) ) ) {                // Set the label that will appear in the start menu context menu.                RegistryEntry( HKEY_LOCAL_MACHINE,                               nsCAutoString( subkey + NS_LITERAL_CSTRING( "\\shell\\properties" ) ).get(),                               "",                                NS_ConvertUCS2toUTF8( label ).get() ).set();            }            RegistryEntry( HKEY_LOCAL_MACHINE,                           nsCAutoString( subkey + NS_LITERAL_CSTRING( "\\shell\\properties\\command" ) ).get(),                           "",                            nsCAutoString( thisApplication() + NS_LITERAL_CSTRING( "-chrome \"chrome://communicator/content/pref/pref.xul\"" ) ).get() ).set();            // Now we need to select our application as the default start menu internet application.            // This is accomplished by first trying to store our subkey name in             // HKLM\Software\Clients\StartMenuInternet's default value.  See            // http://support.microsoft.com/directory/article.asp?ID=KB;EN-US;Q297878 for detail.            SavedRegistryEntry hklmAppEntry( HKEY_LOCAL_MACHINE, baseKey.get(), "", shortAppName().get() );            hklmAppEntry.set();            // That may or may not have worked (depending on whether we have sufficient access).            if ( hklmAppEntry.currentSetting() == hklmAppEntry.setting ) {                // We've set the hklm entry, so we can delete the one under hkcu.                SavedRegistryEntry( HKEY_CURRENT_USER, baseKey.get(), "", 0 ).set();            } else {                // All we can do is set the default start menu internet app for this user.                SavedRegistryEntry( HKEY_CURRENT_USER, baseKey.get(), "", shortAppName().get() );            }            // Notify the system of the changes.            ::SendMessage( HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM)"Software\\Clients\\StartMenuInternet" );        }    }}