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.

168 lines
5.1 KiB

  1. //
  2. // validatedlg.cpp: validation dialog
  3. //
  4. #include "stdafx.h"
  5. #define TRC_GROUP TRC_GROUP_UI
  6. #define TRC_FILE "validatedlg"
  7. #include <atrcapi.h>
  8. #include "validatedlg.h"
  9. #include "sh.h"
  10. CValidateDlg* CValidateDlg::_pValidateDlgInstance = NULL;
  11. CValidateDlg::CValidateDlg( HWND hwndOwner, HINSTANCE hInst, HWND hwndMain,
  12. CSH* pSh) :
  13. CDlgBase( hwndOwner, hInst, UI_IDD_VALIDATE),
  14. _hwndMain(hwndMain),
  15. _pSh(pSh)
  16. {
  17. DC_BEGIN_FN("CValidateDlg");
  18. TRC_ASSERT((NULL == CValidateDlg::_pValidateDlgInstance),
  19. (TB,_T("Clobbering existing dlg instance pointer\n")));
  20. TRC_ASSERT(_pSh,
  21. (TB,_T("_pSh set to NULL")));
  22. CValidateDlg::_pValidateDlgInstance = this;
  23. DC_END_FN();
  24. }
  25. CValidateDlg::~CValidateDlg()
  26. {
  27. CValidateDlg::_pValidateDlgInstance = NULL;
  28. }
  29. DCINT CValidateDlg::DoModal()
  30. {
  31. DCINT retVal = 0;
  32. DC_BEGIN_FN("DoModal");
  33. retVal = DialogBox(_hInstance, MAKEINTRESOURCE(_dlgResId),
  34. _hwndOwner, StaticDialogBoxProc);
  35. TRC_ASSERT((retVal != 0 && retVal != -1), (TB, _T("DialogBoxParam failed\n")));
  36. DC_END_FN();
  37. return retVal;
  38. }
  39. INT_PTR CALLBACK CValidateDlg::StaticDialogBoxProc (HWND hwndDlg, UINT uMsg,WPARAM wParam, LPARAM lParam)
  40. {
  41. //
  42. // Delegate to appropriate instance (only works for single instance dialogs)
  43. //
  44. DC_BEGIN_FN("StaticDialogBoxProc");
  45. DCINT retVal = 0;
  46. TRC_ASSERT(_pValidateDlgInstance, (TB, _T("Validate dialog has NULL static instance ptr\n")));
  47. if(_pValidateDlgInstance)
  48. {
  49. retVal = _pValidateDlgInstance->DialogBoxProc( hwndDlg, uMsg, wParam, lParam);
  50. }
  51. DC_END_FN();
  52. return retVal;
  53. }
  54. /****************************************************************************/
  55. /* Name: DialogBoxProc */
  56. /* */
  57. /* Purpose: Handles Validate Box dialog */
  58. /* */
  59. /* Returns: TRUE if message dealt with */
  60. /* FALSE otherwise */
  61. /* */
  62. /* Params: See window documentation */
  63. /* */
  64. /****************************************************************************/
  65. INT_PTR CALLBACK CValidateDlg::DialogBoxProc (HWND hwndDlg, UINT uMsg,WPARAM wParam, LPARAM lParam)
  66. {
  67. INT_PTR rc = FALSE;
  68. DC_BEGIN_FN("UIValidateDialogProc");
  69. /************************************************************************/
  70. /* Handle dialog messages */
  71. /************************************************************************/
  72. switch(uMsg)
  73. {
  74. case WM_INITDIALOG:
  75. {
  76. _hwndDlg = hwndDlg;
  77. /****************************************************************/
  78. /* Center the dialog */
  79. /****************************************************************/
  80. if(hwndDlg)
  81. {
  82. CenterWindow(_hwndOwner);
  83. SetDialogAppIcon(hwndDlg);
  84. }
  85. rc = TRUE;
  86. }
  87. break;
  88. case WM_COMMAND:
  89. {
  90. switch(DC_GET_WM_COMMAND_ID(wParam))
  91. {
  92. case IDOK:
  93. {
  94. if(hwndDlg)
  95. {
  96. EndDialog(hwndDlg, IDOK);
  97. }
  98. rc = TRUE;
  99. }
  100. break;
  101. case UI_ID_HELP:
  102. {
  103. //
  104. // Display help
  105. //
  106. if(_hwndMain)
  107. {
  108. _pSh->SH_DisplayClientHelp(
  109. _hwndMain,
  110. HH_DISPLAY_TOPIC);
  111. }
  112. rc = TRUE;
  113. }
  114. break;
  115. default:
  116. {
  117. if(hwndDlg)
  118. {
  119. rc = CDlgBase::DialogBoxProc(hwndDlg,
  120. uMsg,
  121. wParam,
  122. lParam);
  123. }
  124. }
  125. break;
  126. }
  127. }
  128. break;
  129. default:
  130. {
  131. if(hwndDlg)
  132. {
  133. rc = CDlgBase::DialogBoxProc(hwndDlg,
  134. uMsg,
  135. wParam,
  136. lParam);
  137. }
  138. }
  139. break;
  140. }
  141. DC_END_FN();
  142. return(rc);
  143. }