Leaked source code of windows server 2003
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.

147 lines
3.9 KiB

  1. #include "precomp.h"
  2. #include "resource.h"
  3. #include "global.h"
  4. #include "PropPg.h"
  5. #include "SetInSht.h"
  6. #include "nmakwiz.h"
  7. #include "nmakreg.h"
  8. ////////////////////////////////////////////////////////////////////////////////////////////////////
  9. // Static member vars
  10. CIntroSheet* CIntroSheet::ms_pIntroSheet = NULL;
  11. CIntroSheet::CIntroSheet( void ) :
  12. m_PropertySheetPage( MAKEINTRESOURCE( IDD_PROPPAGE_DEFAULT ),
  13. CIntroSheet::DlgProc
  14. ),
  15. m_bBeenToNext( FALSE ),
  16. m_pFilePane(NULL)
  17. {
  18. ms_pIntroSheet = this;
  19. }
  20. CIntroSheet::~CIntroSheet(void)
  21. {
  22. delete m_pFilePane;
  23. m_pFilePane = NULL;
  24. ms_pIntroSheet = NULL;
  25. }
  26. ////////////////////////////////////////////////////////////////////////////////////////////////////
  27. // Static member fns
  28. INT_PTR CALLBACK CIntroSheet::DlgProc( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam ) {
  29. switch( message )
  30. {
  31. case WM_INITDIALOG:
  32. {
  33. PropSheet_SetWizButtons( GetParent( hDlg ), PSWIZB_NEXT | PSWIZB_BACK );
  34. ms_pIntroSheet->_CreateFilePane(hDlg);
  35. return TRUE;
  36. }
  37. case WM_NOTIFY:
  38. {
  39. switch( reinterpret_cast< NMHDR FAR* >( lParam )->code )
  40. {
  41. case PSN_QUERYCANCEL:
  42. SetWindowLong( hDlg, DWL_MSGRESULT, !VerifyExitMessageBox());
  43. return TRUE;
  44. case PSN_SETACTIVE:
  45. g_hwndActive = hDlg;
  46. PropSheet_SetWizButtons( GetParent( hDlg ), PSWIZB_NEXT | PSWIZB_BACK );
  47. ms_pIntroSheet->m_pFilePane->Validate(FALSE);
  48. return TRUE;
  49. case PSN_WIZNEXT:
  50. if (!ms_pIntroSheet->m_pFilePane->Validate(TRUE))
  51. {
  52. SetWindowLong(hDlg, DWL_MSGRESULT, -1);
  53. return TRUE;
  54. }
  55. if (ms_pIntroSheet->m_bBeenToNext)
  56. {
  57. g_pWiz->m_SettingsSheet.PrepSettings();
  58. g_pWiz->m_CallModeSheet.PrepSettings();
  59. }
  60. ms_pIntroSheet->m_bBeenToNext = TRUE;
  61. break;
  62. }
  63. break;
  64. }
  65. default:
  66. break;
  67. }
  68. return FALSE;
  69. }
  70. //
  71. // _CreateFilePane()
  72. //
  73. void CIntroSheet::_CreateFilePane(HWND hDlg)
  74. {
  75. RECT rect;
  76. GetClientRect(hDlg, &rect);
  77. int iHeight = rect.bottom - rect.top;
  78. int iWidth = rect.right - CPropertyDataWindow2::mcs_iLeft;
  79. m_pFilePane = new CFilePanePropWnd2(hDlg, IDD_FILEPANE_INTRO,
  80. TEXT("IDD_FILEPANE_INTRO"), 0, CPropertyDataWindow2::mcs_iLeft,
  81. CPropertyDataWindow2::mcs_iTop, iWidth, iHeight);
  82. HWND hwndCond = GetDlgItem(m_pFilePane->GetHwnd(), IDC_RADIO_LOAD_SAVED_CONFIG);
  83. m_pFilePane->ConnectControlsToCheck(IDC_RADIO_LOAD_SAVED_CONFIG, 2,
  84. new CControlID(hwndCond, IDC_RADIO_LOAD_SAVED_CONFIG,
  85. IDE_SAVED_CONFIG_FILE,
  86. CControlID::EDIT),
  87. new CControlID(hwndCond, IDC_RADIO_LOAD_SAVED_CONFIG,
  88. IDC_BROWSE_CONFIG_FILE,
  89. CControlID::CHECK));
  90. m_pFilePane->SetFilePane(TRUE, IDE_SAVED_CONFIG_FILE,
  91. IDC_RADIO_LOAD_SAVED_CONFIG, IDC_BROWSE_CONFIG_FILE,
  92. TEXT("Configuration File (*.ini)"),
  93. TEXT(".ini"), TEXT("Nm3c.ini"));
  94. //
  95. // Get last edited/saved config from registry
  96. //
  97. HKEY hKey;
  98. TCHAR szFile[MAX_PATH];
  99. szFile[0] = 0;
  100. if (RegOpenKey(HKEY_LOCAL_MACHINE, REGKEY_NMRK, &hKey) == ERROR_SUCCESS)
  101. {
  102. DWORD dwType;
  103. DWORD cb;
  104. dwType = REG_SZ;
  105. cb = sizeof(szFile);
  106. RegQueryValueEx(hKey, REGVAL_LASTCONFIG, NULL, &dwType, (LPBYTE)szFile,
  107. &cb);
  108. }
  109. Edit_SetText(GetDlgItem(m_pFilePane->GetHwnd(), IDE_SAVED_CONFIG_FILE), szFile);
  110. m_pFilePane->ShowWindow(TRUE);
  111. m_pFilePane->SetCheck(IDC_RADIO_START_FROM_SCRATCH, TRUE);
  112. }