HKEY theKey;
LRESULT CALLBACK DlgProcInstallSuccessful(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam){  char szBuf[MAX_BUF];  LPNMHDR notifyMessage;  static BOOL launchAppChecked = TRUE;  DWORD result;  HKEY theKey;    switch(msg) {  case WM_INITDIALOG:    // UI Text, from localized config files    SetDlgItemText(hDlg, IDC_STATIC_TITLE, diInstallSuccessful.szMessageHeader);    wsprintf(szBuf, diInstallSuccessful.szMessage0, sgProduct.szProductName);    SetDlgItemText(hDlg, IDC_STATIC0, szBuf);    SetDlgItemText(hDlg, IDC_STATIC1, diInstallSuccessful.szMessage1);    wsprintf(szBuf, diInstallSuccessful.szLaunchApp, sgProduct.szProductName);    SetDlgItemText(hDlg, IDC_START_APP, szBuf);    // The header on the welcome page uses another font.    SendDlgItemMessage(hDlg, IDC_STATIC_TITLE, WM_SETFONT, (WPARAM)sgInstallGui.welcomeTitleFont, 0L);    SendDlgItemMessage(hDlg, IDC_STATIC0, WM_SETFONT, (WPARAM)sgInstallGui.definedFont, 0L);    SendDlgItemMessage(hDlg, IDC_STATIC1, WM_SETFONT, (WPARAM)sgInstallGui.definedFont, 0L);    SendDlgItemMessage(hDlg, IDC_START_APP, WM_SETFONT, (WPARAM)sgInstallGui.definedFont, 0L);    launchAppChecked = diInstallSuccessful.bLaunchAppChecked;    // Subclass dialog to paint all static controls white.    OldDialogWndProc = SubclassWindow(hDlg, (WNDPROC)NewDialogWndProc);    break;  case WM_NOTIFY:    notifyMessage = (LPNMHDR)lParam;    switch (notifyMessage->code) {    case PSN_SETACTIVE:      // Wizard dialog title      PropSheet_SetTitle(GetParent(hDlg), 0, (LPTSTR)diInstallSuccessful.szTitle);       // Restore state from default or cached value.       CheckDlgButton(hDlg, IDC_START_APP,                      launchAppChecked ? BST_CHECKED : BST_UNCHECKED);      // Don't show the back button here UNLESS the previous       // page was Windows Integration - and that only happens on a custom      // install.       PropSheet_SetWizButtons(GetParent(hDlg), PSWIZB_FINISH);      break;    case PSN_WIZBACK:      // Store the checkbox state in case the user goes back to any post-install      // pages that we might add.      launchAppChecked = IsDlgButtonChecked(hDlg, IDC_START_APP) == BST_CHECKED;      break;    case PSN_WIZFINISH:      // Store state from the "Run App Now" checkbox. ProcessFileOpsForAll      // uses this variable to decide whether or not to launch the browser.      gbIgnoreRunAppX = IsDlgButtonChecked(hDlg, IDC_START_APP) != BST_CHECKED;      // Apply settings and close.       if (sgProduct.bInstallFiles)        UpdateJSProxyInfo();      /* POST_SMARTUPDATE process file manipulation functions */      ProcessFileOpsForAll(T_POST_SMARTUPDATE);      if (sgProduct.bInstallFiles) {        /* PRE_LAUNCHAPP process file manipulation functions */        ProcessFileOpsForAll(T_PRE_LAUNCHAPP);        LaunchApps();        // Refresh system icons if necessary        if (gSystemInfo.bRefreshIcons)          RefreshIcons();        UnsetSetupState(); // clear setup state        ClearWinRegUninstallFileDeletion();        if (!gbIgnoreProgramFolderX)          ProcessProgramFolderShowCmd();        CleanupArgsRegistry();        CleanupPreviousVersionRegKeys();        /* POST_LAUNCHAPP process file manipulation functions */        ProcessFileOpsForAll(T_POST_LAUNCHAPP);        /* DEPEND_REBOOT process file manipulation functions */        ProcessFileOpsForAll(T_DEPEND_REBOOT);      }      break;    case PSN_QUERYCANCEL:      // Cancel is meaningless and potentially harmful here (the install work      // is not yet complete). If the user finds a way of cancelling, e.g. by      // clicking the X button on the window, send the FINISH message.       // Assume at least that they didn't want the app to run right away.       gbIgnoreRunAppX = FALSE;      // Send the PSN_WIZFINISH so we can clean up properly.       notifyMessage->code = PSN_WIZFINISH;      SendMessage(hDlg, WM_NOTIFY, wParam, (LPARAM)notifyMessage);      // Tell the Wizard97 framework that we don't want to hard-quit. Processing      // of the PSN_WIZFINISH will cause the app to shut down.       SetWindowLong(hDlg, DWL_MSGRESULT, FALSE);      return TRUE;    }          break;  }    return 0;}