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.

154 lines
4.5 KiB

  1. /*
  2. * WIN1632.H
  3. *
  4. * Macros and other definitions that assist in porting between Win16
  5. * and Win32 applications. Define WIN32 to enable 32-bit versions.
  6. *
  7. * Copyright (c)1993 Microsoft Corporation, All Rights Reserved
  8. *
  9. * Kraig Brockschmidt, Software Design Engineer
  10. * Microsoft Systems Developer Relations
  11. *
  12. * Internet : kraigb@microsoft.com
  13. * Compuserve: INTERNET>kraigb@microsoft.com
  14. */
  15. #ifndef _BOOK1632_H_
  16. #define _BOOK1632_H_
  17. //Macros to handle control message packing between Win16 and Win32
  18. #ifdef WIN32
  19. #define MAKEPOINT MAKEPOINTS
  20. #ifndef COMMANDPARAMS
  21. #define COMMANDPARAMS(wID, wCode, hWndMsg) \
  22. WORD wID = LOWORD(wParam); \
  23. WORD wCode = HIWORD(wParam); \
  24. HWND hWndMsg = (HWND)(UINT)lParam;
  25. #endif //COMMANDPARAMS
  26. #ifndef SendCommand
  27. #define SendCommand(hWnd, wID, wCode, hControl) \
  28. SendMessage(hWnd, WM_COMMAND, MAKELONG(wID, wCode) \
  29. , (LPARAM)hControl)
  30. #endif //SendCommand
  31. #ifndef MENUSELECTPARAMS
  32. #define MENUSELECTPARAMS(wID, wFlags, hMenu) \
  33. WORD wID = LOWORD(wParam); \
  34. WORD wFlags = HIWORD(wParam); \
  35. HMENU hMenu = (HMENU)lParam;
  36. #endif //MENUSELECTPARAMS
  37. #ifndef SendMenuSelect
  38. #define SendMenuSelect(hWnd, wID, wFlags, hMenu) \
  39. SendMessage(hWnd, WM_MENUSELECT, MAKELONG(wID, wFlags) \
  40. , (LPARAM)hMenu)
  41. #endif //SendMenuSelect
  42. #ifndef SendScrollPosition
  43. #define SendScrollPosition(hWnd, iMsg, iPos) \
  44. SendMessage(hWnd, iMsg, MAKELONG(SB_THUMBPOSITION, iPos), 0)
  45. #endif //SendScrollPosition
  46. #ifndef ScrollThumbPosition
  47. #define ScrollThumbPosition(w, l) HIWORD(w)
  48. #endif //ScrollThumbPosition
  49. #ifndef GETWINDOWINSTANCE
  50. #define GETWINDOWINSTANCE(h) (HINSTANCE)GetWindowLong(h, GWL_HINSTANCE)
  51. #endif //GETWINDOWINSTANCE
  52. #ifndef GETWINDOWID
  53. #define GETWINDOWID(h) (UINT)GetWindowLong(h, GWW_ID)
  54. #endif //GETWINDOWID
  55. #ifndef POINTFROMLPARAM
  56. #define POINTFROMLPARAM(p, l) {p.x=(LONG)(SHORT)LOWORD(l); \
  57. p.y=(LONG)(SHORT)HIWORD(l);}
  58. #endif //POINTEFROMLPARAM
  59. #ifndef EXPORT
  60. #define EXPORT
  61. #endif //EXPORT
  62. #ifndef MDIREFRESHMENU
  63. #define MDIREFRESHMENU(h) SendMessage(h, WM_MDIREFRESHMENU, 0, 0L)
  64. #endif //MDIREFRESHMENU
  65. //****END WIN32
  66. #else
  67. //****START !WIN32
  68. #ifndef COMMANDPARAMS
  69. #define COMMANDPARAMS(wID, wCode, hWndMsg) \
  70. WORD wID = LOWORD(wParam); \
  71. WORD wCode = HIWORD(lParam); \
  72. HWND hWndMsg = (HWND)(UINT)lParam;
  73. #endif //COMMANDPARAMS
  74. #ifndef SendCommand
  75. #define SendCommand(hWnd, wID, wCode, hControl) \
  76. SendMessage(hWnd, WM_COMMAND, wID \
  77. , MAKELONG(hControl, wCode))
  78. #endif //SendCommand
  79. #ifndef MENUSELECTPARAMS
  80. #define MENUSELECTPARAMS(wID, wFlags, hMenu) \
  81. WORD wID = LOWORD(wParam); \
  82. WORD wFlags = LOWORD(lParam); \
  83. HMENU hMenu = (HMENU)HIWORD(lParam);
  84. #endif //MENUSELECTPARAMS
  85. #ifndef SendMenuSelect
  86. #define SendMenuSelect(hWnd, wID, wFlags, hMenu) \
  87. SendMessage(hWnd, WM_MENUSELECT, wID \
  88. , MAKELONG(wFlags, hMenu))
  89. #endif //SendMenuSelect
  90. #ifndef SendScrollPosition
  91. #define SendScrollPosition(hWnd, iMsg, iPos) \
  92. SendMessage(hWnd, iMsg, SB_THUMBPOSITION, MAKELONG(iPos, 0))
  93. #endif //Send ScrollPosition
  94. #ifndef ScrollThumbPosition
  95. #define ScrollThumbPosition(w, l) LOWORD(l)
  96. #endif //ScrollThumbPosition
  97. #ifndef GETWINDOWINSTANCE
  98. #define GETWINDOWINSTANCE(h) (HINSTANCE)GetWindowWord(h, GWW_HINSTANCE)
  99. #endif //GETWINDOWINSTANCE
  100. #ifndef GETWINDOWID
  101. #define GETWINDOWID(h) (UINT)GetWindowWord(h, GWW_ID)
  102. #endif //GETWINDOWID
  103. #ifndef POINTFROMLPARAM
  104. #define POINTFROMLPARAM(p, l) {p.x=LOWORD(l); p.y=HIWORD(l);}
  105. #endif //POINTEFROMLPARAM
  106. #ifndef EXPORT
  107. #define EXPORT __export
  108. #endif //EXPORT
  109. #ifndef MDIREFRESHMENU
  110. #define MDIREFRESHMENU(h) SendMessage(h, WM_MDISETMENU, TRUE, 0L)
  111. #endif //MDIREFRESHMENU
  112. #endif //!WIN32
  113. #endif //_BOOK1632_H_