Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

94 lines
2.0 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // HOWTORUN.CPP / Tuneup
  4. //
  5. // Microsoft Confidential
  6. // Copyright (c) Microsoft Corporation 1998
  7. // All rights reserved
  8. //
  9. // 8/98 - Jason Cohen (JCOHEN)
  10. //
  11. //////////////////////////////////////////////////////////////////////////////
  12. // Include file(s).
  13. //
  14. #include <windows.h>
  15. #include <tchar.h>
  16. #include "main.h"
  17. #include "resource.h"
  18. #include "registry.h"
  19. #include "miscfunc.h"
  20. #include "runnow.h"
  21. // Inernal function prototype(s).
  22. //
  23. static BOOL CALLBACK HowToRunDlgProc(HWND, UINT, WPARAM, LPARAM);
  24. BOOL HowToRun()
  25. {
  26. return (DialogBox(g_hInst, MAKEINTRESOURCE(IDD_FIRST), NULL, (DLGPROC) HowToRunDlgProc) != 0);
  27. }
  28. static BOOL CALLBACK HowToRunDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
  29. {
  30. switch (message)
  31. {
  32. case WM_COMMAND:
  33. switch ( (INT) LOWORD(wParam) )
  34. {
  35. case IDOK:
  36. // If the user choose "change", we want to save that so it defaults to it
  37. // the next time he runs the wizard.
  38. //
  39. RegSetString(HKLM, g_szTuneupKey, g_szRegValChange, IsDlgButtonChecked(hDlg, IDC_CHANGE) ? _T("1") : _T("0"));
  40. if ( IsDlgButtonChecked(hDlg, IDC_CHANGE) )
  41. {
  42. // End with 1 so that the wizard will run.
  43. //
  44. EndDialog(hDlg, 1);
  45. }
  46. else
  47. {
  48. // Run the tasks now.
  49. //
  50. ShowEnableWindow(hDlg, FALSE);
  51. RunTasksNow(hDlg, g_Tasks);
  52. EndDialog(hDlg, 0);
  53. }
  54. break;
  55. case IDCANCEL:
  56. EndDialog(hDlg, 0);
  57. break;
  58. default:
  59. return TRUE;
  60. }
  61. return 0;
  62. case WM_INITDIALOG:
  63. // Set the initial state of the radio buttons. If the user previously used
  64. // the change setting last, check that radio button. Otherwise, default
  65. // to the run now button.
  66. //
  67. CheckRadioButton(hDlg, IDC_RUNNOW, IDC_CHANGE, RegCheck(HKLM, g_szTuneupKey, g_szRegValChange) ? IDC_CHANGE : IDC_RUNNOW);
  68. return FALSE;
  69. case WM_CLOSE:
  70. EndDialog(hDlg, 0);
  71. return TRUE;
  72. default:
  73. return FALSE;
  74. }
  75. }