} else if ((nsNativeAppSupportWin::mTrayRestart) && (msg == nsNativeAppSupportWin::mTrayRestart)) {  ::Shell_NotifyIcon( NIM_ADD, &nsNativeAppSupportWin::mIconData );
    static long CALLBACK WindowProc( HWND msgWindow, UINT msg, WPARAM wp, LPARAM lp ) {        if ( msg == WM_COPYDATA ) {            // This is an incoming request.            COPYDATASTRUCT *cds = (COPYDATASTRUCT*)lp;#if MOZ_DEBUG_DDE            printf( "Incoming request: %s\n", (const char*)cds->lpData );#endif            (void)nsNativeAppSupportWin::HandleRequest( (LPBYTE)cds->lpData );            // Get current window and return its window handle.            nsCOMPtr<nsIDOMWindowInternal> win;            GetMostRecentWindow( 0, getter_AddRefs( win ) );            return win ? (long)hwndForDOMWindow( win ) : 0; } else if ( msg == WM_USER ) {     if ( lp == WM_RBUTTONUP ) {         // Show menu with Exit disabled/enabled appropriately.         nsCOMPtr<nsIDOMWindowInternal> win;         GetMostRecentWindow( 0, getter_AddRefs( win ) );         ::EnableMenuItem( nsNativeAppSupportWin::mTrayIconMenu, TURBO_EXIT, win ? MF_GRAYED : MF_ENABLED );         POINT pt;         GetCursorPos( &pt );         SetForegroundWindow(msgWindow);         int selectedItem = ::TrackPopupMenu( nsNativeAppSupportWin::mTrayIconMenu,                                              TPM_NONOTIFY | TPM_RETURNCMD |                                              TPM_RIGHTBUTTON,                                              pt.x,                                              pt.y,                                              0,                                              msgWindow,                                              0 );         switch (selectedItem) {         case TURBO_NAVIGATOR:             (void)nsNativeAppSupportWin::HandleRequest( (LPBYTE)"mozilla -browser" );             break;         case TURBO_MAIL:             (void)nsNativeAppSupportWin::HandleRequest( (LPBYTE)"mozilla -mail" );              break;         case TURBO_EDITOR:             (void)nsNativeAppSupportWin::HandleRequest( (LPBYTE)"mozilla -editor" );             break;         case TURBO_ADDRESSBOOK:             (void)nsNativeAppSupportWin::HandleRequest( (LPBYTE)"mozilla -addressbook" );             break;         case TURBO_EXIT:             (void)nsNativeAppSupportWin::HandleRequest( (LPBYTE)"mozilla -kill" );             break;         case TURBO_DISABLE:             nsresult rv;             nsCOMPtr<nsIStringBundleService> stringBundleService( do_GetService( NS_STRINGBUNDLE_CONTRACTID ) );             nsCOMPtr<nsIStringBundle> turboMenuBundle;             nsCOMPtr<nsIStringBundle> brandBundle;             if ( stringBundleService ) {                 stringBundleService->CreateBundle( "chrome://global/locale/brand.properties", getter_AddRefs( brandBundle ) );                 stringBundleService->CreateBundle( "chrome://navigator/locale/turboMenu.properties",                                                    getter_AddRefs( turboMenuBundle ) );             }             nsXPIDLString dialogMsg;             nsXPIDLString dialogTitle;             nsXPIDLString brandName;             if ( brandBundle && turboMenuBundle ) {                 brandBundle->GetStringFromName( NS_LITERAL_STRING( "brandShortName" ).get(),                                                 getter_Copies( brandName ) );                 const PRUnichar *formatStrings[] = { brandName.get() };                 turboMenuBundle->FormatStringFromName( NS_LITERAL_STRING( "DisableDlgMsg" ).get(), formatStrings,                                                        1, getter_Copies( dialogMsg ) );                 turboMenuBundle->FormatStringFromName( NS_LITERAL_STRING( "DisableDlgTitle" ).get(), formatStrings,                                                        1, getter_Copies( dialogTitle ) );             }             if ( dialogMsg.get() && dialogTitle.get() && brandName.get() ) {                 nsCOMPtr<nsIPromptService> dialog( do_GetService( "@mozilla.org/embedcomp/prompt-service;1" ) );                 if ( dialog ) {                     PRBool reallyDisable;                     nsNativeAppSupportWin::mLastWindowIsConfirmation = PR_TRUE;                     dialog->Confirm( nsnull, dialogTitle.get(), dialogMsg.get(), &reallyDisable );                     if ( !reallyDisable ) {                          break;                     }                 }             }             nsCOMPtr<nsIWindowsHooks> winHooksService ( do_GetService( NS_IWINDOWSHOOKS_CONTRACTID, &rv ) );             if ( NS_SUCCEEDED( rv ) )                 winHooksService->StartupRemoveOption("-turbo");             nsCOMPtr<nsIAppShellService> appShell = do_GetService( "@mozilla.org/appshell/appShellService;1", &rv );             if ( NS_SUCCEEDED( rv ) ) {                 nsCOMPtr<nsINativeAppSupport> native;                 rv = appShell->GetNativeAppSupport( getter_AddRefs( native ) );                 if ( NS_SUCCEEDED( rv ) )                     native->SetIsServerMode( PR_FALSE );                 if ( !win )                     appShell->Quit();             }             break;         }         PostMessage(msgWindow, WM_NULL, 0, 0);     } else if ( lp == WM_LBUTTONDBLCLK ) {         // Dbl-click will open nav/mailnews/composer based on prefs         // (if no windows are open), or, open nav (if some windows are         // already open).  That's done in HandleRequest.         (void)nsNativeAppSupportWin::HandleRequest( (LPBYTE)"mozilla" );     }     return TRUE;  } else if ( msg == WM_QUERYENDSESSION ) {    // Invoke "-killAll" cmd line handler.  That will close all open windows,    // and display dialog asking whether to save/don't save/cancel.  If the    // user says cancel, then we pass that indicator along to the system    // in order to stop the system shutdown/logoff.    nsCOMPtr<nsICmdLineHandler>        killAll( do_CreateInstance( "@mozilla.org/commandlinehandler/general-startup;1?type=killAll" ) );    if ( killAll ) {        nsXPIDLCString unused;        // Note: "GetChromeUrlForTask" is a euphemism for        //       "ProcessYourCommandLineSwitch".  The interface was written        //       presuming a less general-purpose role for command line        //       handlers than it ought to have.        nsresult rv = killAll->GetChromeUrlForTask( getter_Copies( unused ) );        if ( rv == NS_ERROR_ABORT ) {            // User cancelled shutdown/logoff.            return FALSE;        } else {            // Shutdown/logoff OK.            return TRUE;        }    }  }  return DefWindowProc( msgWindow, msg, wp, lp );}