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.

141 lines
3.2 KiB

  1. #include "dlg.h"
  2. #include "utils.h"
  3. #include <mluisupp.h>
  4. INT_PTR Dlg_MsgProc(const MSD *pmsd, HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
  5. {
  6. MMF mmf;
  7. INT_PTR fResult = FALSE;
  8. if (msg == WM_SETFONT) {
  9. // MACRO_LI_SmartRemoveFlags(LIF_LINE);
  10. // Out(LI0("Dialog is created..."));
  11. }
  12. ASSERT(pmsd != NULL);
  13. for (; pmsd->ms != ms_end; pmsd++)
  14. if (pmsd->msg == msg) {
  15. mmf.pfn = pmsd->pfn;
  16. switch (pmsd->ms) {
  17. case ms_lwwwl:
  18. fResult = (INT_PTR)(*mmf.pfn_lwwwl)(hDlg, msg, wp, lp);
  19. break;
  20. case ms_bwwwl:
  21. fResult = (*mmf.pfn_bwwwl)(hDlg, msg, wp, lp);
  22. break;
  23. case ms_vv:
  24. (*mmf.pfn_vv)();
  25. fResult = TRUE;
  26. break;
  27. case ms_bv:
  28. fResult = (*mmf.pfn_bv)();
  29. break;
  30. case ms_vw:
  31. (*mmf.pfn_vw)(wp);
  32. fResult = TRUE;
  33. break;
  34. case ms_vh:
  35. (*mmf.pfn_vh)(hDlg);
  36. fResult = TRUE;
  37. break;
  38. case ms_bh:
  39. fResult = (*mmf.pfn_bh)(hDlg);
  40. break;
  41. case ms_bhl:
  42. fResult = (*mmf.pfn_bhl)(hDlg, lp);
  43. break;
  44. default:
  45. ASSERT(FALSE);
  46. }
  47. break;
  48. }
  49. if (msg == WM_NCDESTROY) {
  50. // MACRO_LI_SmartRemoveFlags(LIF_LINE);
  51. // Out(LI0("Dialog is destroying..."));
  52. }
  53. return fResult;
  54. }
  55. BOOL Msg_OnCmd(const CMD *pcmd, HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
  56. {
  57. MMF mmf;
  58. UINT nID = GET_WM_COMMAND_ID(wp, lp);
  59. BOOL fResult = FALSE;
  60. //----- Look for message map entry -----
  61. for (; pcmd->ms != ms_end; pcmd++)
  62. if ((pcmd->nLastID <= pcmd->nID && pcmd->nID == nID) ||
  63. (nID >= pcmd->nID && nID <= pcmd->nLastID))
  64. break;
  65. if (pcmd->ms == ms_end) {
  66. if (nID == IDOK || nID == IDCANCEL)
  67. EndDialog(hDlg, nID);
  68. return fResult;
  69. }
  70. //----- Dispatch based on function signature -----
  71. mmf.pfn = pcmd->pfn;
  72. switch (pcmd->ms) {
  73. case ms_vv:
  74. (*mmf.pfn_vv)();
  75. fResult = TRUE;
  76. break;
  77. case ms_bv:
  78. fResult = (*mmf.pfn_bv)();
  79. break;
  80. case ms_vw:
  81. (*mmf.pfn_vw)(nID);
  82. fResult = TRUE;
  83. break;
  84. case ms_vh:
  85. (*mmf.pfn_vh)(hDlg);
  86. fResult = TRUE;
  87. break;
  88. case ms_bh:
  89. fResult = (*mmf.pfn_bh)(hDlg);
  90. break;
  91. case ms_vhww:
  92. (*mmf.pfn_vhww)(hDlg, nID, GET_WM_COMMAND_CMD(wp, lp));
  93. fResult = TRUE;
  94. break;
  95. case ms_vhhw:
  96. (*mmf.pfn_vhhw)(hDlg, GetDlgItem(hDlg, nID),
  97. GET_WM_COMMAND_CMD(wp, lp));
  98. fResult = TRUE;
  99. break;
  100. default:
  101. ASSERT(FALSE);
  102. }
  103. //----- Special processing -----
  104. if (nID == IDOK || nID == IDCANCEL)
  105. if (pcmd->ms != ms_end) {
  106. if (fResult)
  107. EndDialog(hDlg, nID);
  108. }
  109. else
  110. EndDialog(hDlg, nID);
  111. return fResult;
  112. }