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.

117 lines
3.2 KiB

  1. #ifndef WIN32_LEAN_AND_MEAN
  2. #define WIN32_LEAN_AND_MEAN
  3. #endif
  4. #include <windows.h>
  5. #include <windowsx.h>
  6. #include <commctrl.h>
  7. #include "dispatch.h"
  8. LRESULT DispMessage(LPMSDI lpmsdi,
  9. HWND hwnd,
  10. UINT uMessage,
  11. WPARAM wparam,
  12. LPARAM lparam)
  13. {
  14. int imsd = 0;
  15. MSD *rgmsd = lpmsdi->rgmsd;
  16. int cmsd = lpmsdi->cmsd;
  17. for (imsd = 0; imsd < cmsd; imsd++)
  18. {
  19. if (rgmsd[imsd].uMessage == uMessage)
  20. return rgmsd[imsd].pfnmsg(hwnd, uMessage, wparam, lparam);
  21. }
  22. return DispDefault(lpmsdi->edwp, hwnd, uMessage, wparam, lparam);
  23. }
  24. ////////////////////////////////////////////////////////////////
  25. // Function : DispCommand
  26. // Type : LRESULT
  27. // Purpose :
  28. // :
  29. // Argument :
  30. // : LPCMDI lpcmdi
  31. // : HWND hwnd
  32. // : WPARAM wparam
  33. // : LPARAM lparam
  34. // Return :
  35. // AUTHOR : �g�Ɨ���(ToshiaK)
  36. // START DATE:
  37. // HISTORY :
  38. //
  39. /////////////////////////////////////////////////////////////////
  40. LRESULT DispCommand(LPCMDI lpcmdi,
  41. HWND hwnd,
  42. WPARAM wparam,
  43. LPARAM lparam)
  44. {
  45. //LRESULT lRet = 0;
  46. WORD wCommand = GET_WM_COMMAND_ID(wparam, lparam);
  47. int icmd;
  48. CMD *rgcmd = lpcmdi->rgcmd;
  49. int ccmd = lpcmdi->ccmd;
  50. // Message packing of wparam and lparam have changed for Win32,
  51. // so use the GET_WM_COMMAND macro to unpack the commnad
  52. for (icmd = 0; icmd < ccmd; icmd++)
  53. {
  54. if (rgcmd[icmd].wCommand == wCommand)
  55. {
  56. return rgcmd[icmd].pfncmd(hwnd,
  57. wCommand,
  58. GET_WM_COMMAND_CMD(wparam, lparam),
  59. GET_WM_COMMAND_HWND(wparam, lparam));
  60. }
  61. }
  62. return DispDefault(lpcmdi->edwp, hwnd, WM_COMMAND, wparam, lparam);
  63. }
  64. ////////////////////////////////////////////////////////////////
  65. // Function : DispDefault
  66. // Type : LRESULT
  67. // Purpose :
  68. // :
  69. // Argument :
  70. // : EDWP edwp
  71. // : HWND hwnd
  72. // : UINT uMessage
  73. // : WPARAM wparam
  74. // : LPARAM lparam
  75. // Return :
  76. // AUTHOR : �g�Ɨ���(ToshiaK)
  77. // START DATE:
  78. // HISTORY :
  79. //
  80. /////////////////////////////////////////////////////////////////
  81. #define hwndMDIClient NULL
  82. LRESULT DispDefault(EDWP edwp,
  83. HWND hwnd,
  84. UINT uMessage,
  85. WPARAM wparam,
  86. LPARAM lparam)
  87. {
  88. switch (edwp)
  89. {
  90. case edwpNone:
  91. return 0;
  92. case edwpWindow:
  93. return DefWindowProc(hwnd, uMessage, wparam, lparam);
  94. case edwpDialog:
  95. return DefDlgProc(hwnd, uMessage, wparam, lparam);
  96. #ifndef UNDER_CE // Windows CE does not support MDI func
  97. case edwpMDIFrame:
  98. return DefFrameProc(hwnd, hwndMDIClient, uMessage, wparam, lparam);
  99. case edwpMDIChild:
  100. return DefMDIChildProc(hwnd, uMessage, wparam, lparam);
  101. #endif // UNDER_CE
  102. }
  103. return 0;
  104. }