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.

169 lines
4.3 KiB

  1. #include "precomp.h"
  2. #pragma hdrstop
  3. /***************************************************************************/
  4. /****************** Basic Class Dialog Handlers ****************************/
  5. /***************************************************************************/
  6. /*
  7. *****************************************************************************/
  8. PCSTR PropName = "_helpactiveprop";
  9. INT_PTR APIENTRY
  10. FGstMaintDlgProc(
  11. HWND hdlg,
  12. UINT wMsg,
  13. WPARAM wParam,
  14. LPARAM lParam
  15. )
  16. {
  17. CHP rgchNum[10];
  18. WORD idc;
  19. PSZ psz;
  20. RGSZ rgsz;
  21. SZ sz;
  22. static HICON hiconOld = NULL;
  23. Unused(lParam);
  24. switch (wMsg) {
  25. case STF_REINITDIALOG:
  26. if ((sz = SzFindSymbolValueInSymTab("ReInit")) == (SZ)NULL ||
  27. (CrcStringCompareI(sz, "YES") != crcEqual)) {
  28. return(fTrue);
  29. }
  30. case WM_INITDIALOG:
  31. SetProp(hdlg,PropName,(HANDLE)FALSE);
  32. if( wMsg == WM_INITDIALOG ) {
  33. FCenterDialogOnDesktop(hdlg);
  34. }
  35. if( !hiconOld ) {
  36. hiconOld = (HICON)GetClassLongPtr(hdlg, GCLP_HICON);
  37. SetClassLongPtr(hdlg, GCLP_HICON, (LONG_PTR)LoadIcon(MyDllModuleHandle, MAKEINTRESOURCE(IDI_STF_ICON)));
  38. // above was GetModuleHandle(NULL)
  39. }
  40. // Handle all the text status fields in this dialog
  41. if ((sz = SzFindSymbolValueInSymTab("TextFields")) != (SZ)NULL) {
  42. WORD idcStatus;
  43. while ((psz = rgsz = RgszFromSzListValue(sz)) == (RGSZ)NULL) {
  44. if (!FHandleOOM(hdlg)) {
  45. DestroyWindow(GetParent(hdlg));
  46. return(fTrue);
  47. }
  48. }
  49. idcStatus = IDC_TEXT1;
  50. while (*psz != (SZ)NULL && GetDlgItem(hdlg, idcStatus)) {
  51. SetDlgItemText (hdlg, idcStatus++,*psz++);
  52. }
  53. EvalAssert(FFreeRgsz(rgsz));
  54. }
  55. return(fTrue);
  56. case WM_CLOSE:
  57. PostMessage(
  58. hdlg,
  59. WM_COMMAND,
  60. MAKELONG(IDC_X, BN_CLICKED),
  61. 0L
  62. );
  63. return(fTrue);
  64. case WM_COMMAND:
  65. switch (idc = LOWORD(wParam)) {
  66. case MENU_HELPINDEX:
  67. case MENU_HELPSEARCH:
  68. case MENU_HELPONHELP:
  69. if(FProcessWinHelpMenu( hdlg, idc )) {
  70. SetProp(hdlg,PropName,(HANDLE)TRUE);
  71. }
  72. break;
  73. case MENU_ABOUT:
  74. {
  75. TCHAR Title[100];
  76. LoadString(MyDllModuleHandle,IDS_APP_TITLE,Title,sizeof(Title)/sizeof(TCHAR));
  77. // above was GetModuleHandle(NULL)
  78. ShellAbout(hdlg,Title,NULL,(HICON)GetClassLongPtr(hdlg,GCLP_HICON));
  79. }
  80. break;
  81. case MENU_EXIT:
  82. PostMessage(
  83. hdlg,
  84. WM_COMMAND,
  85. MAKELONG(IDC_X, BN_CLICKED),
  86. 0L
  87. );
  88. return(fTrue);
  89. case IDCANCEL:
  90. if (LOWORD(wParam) == IDCANCEL) {
  91. if (!GetDlgItem(hdlg, IDC_B) || HIWORD(GetKeyState(VK_CONTROL)) || HIWORD(GetKeyState(VK_SHIFT)) || HIWORD(GetKeyState(VK_MENU)))
  92. {
  93. break;
  94. }
  95. wParam = IDC_B;
  96. }
  97. case MENU_CHANGE:
  98. case IDC_O:
  99. case IDC_C:
  100. case IDC_M:
  101. case IDC_B:
  102. case IDC_X:
  103. case IDC_BTN0:
  104. case IDC_BTN1: case IDC_BTN2: case IDC_BTN3:
  105. case IDC_BTN4: case IDC_BTN5: case IDC_BTN6:
  106. case IDC_BTN7: case IDC_BTN8: case IDC_BTN9:
  107. _itoa((INT)wParam, rgchNum, 10);
  108. while (!FAddSymbolValueToSymTab("ButtonPressed", rgchNum))
  109. if (!FHandleOOM(hdlg))
  110. {
  111. DestroyWindow(GetParent(hdlg));
  112. return(fTrue);
  113. }
  114. PostMessage(GetParent(hdlg), (WORD)STF_UI_EVENT, 0, 0L);
  115. break;
  116. }
  117. break;
  118. case STF_DESTROY_DLG:
  119. if(GetProp(hdlg,PropName)) {
  120. WinHelp(hdlg,NULL,HELP_QUIT,0);
  121. }
  122. if (hiconOld) {
  123. SetClassLongPtr(hdlg, GCLP_HICON, (LONG_PTR)hiconOld);
  124. hiconOld = NULL;
  125. }
  126. PostMessage(GetParent(hdlg), (WORD)STF_MAINT_DLG_DESTROYED, 0, 0L);
  127. DestroyWindow(hdlg);
  128. return(fTrue);
  129. }
  130. return(fFalse);
  131. }