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.

211 lines
7.6 KiB

  1. //==========================================================================;
  2. //
  3. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
  4. // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED
  5. // TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR
  6. // A PARTICULAR PURPOSE.
  7. //
  8. // Copyright (C) 1993 - 1997 Microsoft Corporation. All Rights Reserved.
  9. //
  10. //--------------------------------------------------------------------------;
  11. //
  12. // appport.h -- Win 16/32 Portability Stuff
  13. //
  14. // Description:
  15. // This file contains common macros to help with writing code that
  16. // cross compiles between Win 32 and Win 16. This file should be
  17. // included _after_ windows.h and windowsx.h.
  18. //
  19. // History:
  20. // 11/ 8/92 created.
  21. //
  22. //==========================================================================;
  23. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  24. //
  25. // Win 32
  26. //
  27. //
  28. //
  29. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  30. #ifdef WIN32
  31. #ifndef FNLOCAL
  32. #define FNLOCAL _stdcall
  33. #define FNCLOCAL _stdcall
  34. #define FNGLOBAL _stdcall
  35. #define FNCGLOBAL _stdcall
  36. #define FNCALLBACK CALLBACK
  37. #define FNEXPORT CALLBACK
  38. #endif
  39. //
  40. //
  41. //
  42. #define Edit_GetSelEx(hwndCtl, pnS, pnE) \
  43. ((DWORD)SendMessage((hwndCtl), EM_GETSEL, (WPARAM)pnS, (LPARAM)pnE))
  44. //
  45. // for compiling Unicode
  46. //
  47. #ifdef UNICODE
  48. #define SIZEOF(x) (sizeof(x)/sizeof(WCHAR))
  49. #else
  50. #define SIZEOF(x) sizeof(x)
  51. #endif
  52. //
  53. // win32 apps [usually] don't have to worry about 'huge' data
  54. //
  55. #if !defined hmemcpy
  56. #define hmemcpy memcpy
  57. #endif
  58. #endif // #ifdef WIN32
  59. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  60. //
  61. // Win 16
  62. //
  63. //
  64. //
  65. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  66. #ifndef WIN32
  67. #ifndef FNLOCAL
  68. #define FNLOCAL NEAR PASCAL
  69. #define FNCLOCAL NEAR _cdecl
  70. #define FNGLOBAL FAR PASCAL
  71. #define FNCGLOBAL FAR _cdecl
  72. #define FNCALLBACK CALLBACK
  73. #define FNEXPORT CALLBACK _export
  74. #endif
  75. //
  76. // stuff for Unicode in Win 32--make it a noop in Win 16
  77. //
  78. #ifndef _TCHAR_DEFINED
  79. #define _TCHAR_DEFINED
  80. typedef char TCHAR, *PTCHAR;
  81. typedef unsigned char TBYTE, *PTUCHAR;
  82. typedef PSTR PTSTR, PTCH;
  83. typedef const PTSTR PCTSTR;
  84. typedef LPSTR LPTSTR, LPTCH;
  85. typedef LPCSTR LPCTSTR;
  86. #endif
  87. #define TEXT(a) a
  88. #define SIZEOF(x) sizeof(x)
  89. //
  90. //
  91. //
  92. #define CharNext AnsiNext
  93. #define CharPrev AnsiPrev
  94. //
  95. //
  96. //
  97. #define Edit_GetSelEx(hwndCtl, pnS, pnE) \
  98. { \
  99. DWORD dw; \
  100. dw = (DWORD)SendMessage((hwndCtl), EM_GETSEL, 0, 0L); \
  101. *pnE = (int)HIWORD(dw); \
  102. *pnS = (int)LOWORD(dw); \
  103. }
  104. //
  105. // common message cracker macros available in windowx.h on NT--these
  106. // should be added to the Win 16 windowsx.h and probably will be
  107. // in the future.
  108. //
  109. // there is a windowsx.h16 that ships with the NT PDK that defines
  110. // these macros. so if that version is being used, don't redefine
  111. // message crackers.
  112. //
  113. #ifndef WM_CTLCOLORMSGBOX
  114. #define WM_CTLCOLORMSGBOX 0x0132
  115. #define WM_CTLCOLOREDIT 0x0133
  116. #define WM_CTLCOLORLISTBOX 0x0134
  117. #define WM_CTLCOLORBTN 0x0135
  118. #define WM_CTLCOLORDLG 0x0136
  119. #define WM_CTLCOLORSCROLLBAR 0x0137
  120. #define WM_CTLCOLORSTATIC 0x0138
  121. #endif
  122. #ifndef GET_WM_ACTIVATE_STATE
  123. #define GET_WM_ACTIVATE_STATE(wp, lp) (wp)
  124. #define GET_WM_ACTIVATE_FMINIMIZED(wp, lp) (BOOL)HIWORD(lp)
  125. #define GET_WM_ACTIVATE_HWND(wp, lp) (HWND)LOWORD(lp)
  126. #define GET_WM_ACTIVATE_MPS(s, fmin, hwnd) (WPARAM)(s), MAKELONG(hwnd, fmin)
  127. #define GET_WM_CHARTOITEM_CHAR(wp, lp) (CHAR)(wp)
  128. #define GET_WM_CHARTOITEM_POS(wp, lp) HIWORD(lp)
  129. #define GET_WM_CHARTOITEM_HWND(wp, lp) (HWND)LOWORD(lp)
  130. #define GET_WM_CHARTOITEM_MPS(ch, pos, hwnd) (WPARAM)(ch), MAKELONG(hwnd, pos)
  131. #define GET_WM_COMMAND_ID(wp, lp) (wp)
  132. #define GET_WM_COMMAND_HWND(wp, lp) (HWND)LOWORD(lp)
  133. #define GET_WM_COMMAND_CMD(wp, lp) HIWORD(lp)
  134. #define GET_WM_COMMAND_MPS(id, hwnd, cmd) (WPARAM)(id), MAKELONG(hwnd, cmd)
  135. #define GET_WM_CTLCOLOR_HDC(wp, lp, msg) (HDC)(wp)
  136. #define GET_WM_CTLCOLOR_HWND(wp, lp, msg) (HWND)LOWORD(lp)
  137. #define GET_WM_CTLCOLOR_TYPE(wp, lp, msg) HIWORD(lp)
  138. #define GET_WM_CTLCOLOR_MPS(hdc, hwnd, type) (WPARAM)(hdc), MAKELONG(hwnd, type)
  139. #define GET_WM_MENUSELECT_CMD(wp, lp) (wp)
  140. #define GET_WM_MENUSELECT_FLAGS(wp, lp) LOWORD(lp)
  141. #define GET_WM_MENUSELECT_HMENU(wp, lp) (HMENU)HIWORD(lp)
  142. #define GET_WM_MENUSELECT_MPS(cmd, f, hmenu) (WPARAM)(cmd), MAKELONG(f, hmenu)
  143. // Note: the following are for interpreting MDIclient to MDI child messages.
  144. #define GET_WM_MDIACTIVATE_FACTIVATE(hwnd, wp, lp) (BOOL)(wp)
  145. #define GET_WM_MDIACTIVATE_HWNDDEACT(wp, lp) (HWND)HIWORD(lp)
  146. #define GET_WM_MDIACTIVATE_HWNDACTIVATE(wp, lp) (HWND)LOWORD(lp)
  147. // Note: the following is for sending to the MDI client window.
  148. #define GET_WM_MDIACTIVATE_MPS(f, hwndD, hwndA) (WPARAM)(hwndA), 0
  149. #define GET_WM_MDISETMENU_MPS(hmenuF, hmenuW) 0, MAKELONG(hmenuF, hmenuW)
  150. #define GET_WM_MENUCHAR_CHAR(wp, lp) (CHAR)(wp)
  151. #define GET_WM_MENUCHAR_HMENU(wp, lp) (HMENU)LOWORD(lp)
  152. #define GET_WM_MENUCHAR_FMENU(wp, lp) (BOOL)HIWORD(lp)
  153. #define GET_WM_MENUCHAR_MPS(ch, hmenu, f) (WPARAM)(ch), MAKELONG(hmenu, f)
  154. #define GET_WM_PARENTNOTIFY_MSG(wp, lp) (wp)
  155. #define GET_WM_PARENTNOTIFY_ID(wp, lp) HIWORD(lp)
  156. #define GET_WM_PARENTNOTIFY_HWNDCHILD(wp, lp) (HWND)LOWORD(lp)
  157. #define GET_WM_PARENTNOTIFY_X(wp, lp) (INT)LOWORD(lp)
  158. #define GET_WM_PARENTNOTIFY_Y(wp, lp) (INT)HIWORD(lp)
  159. #define GET_WM_PARENTNOTIFY_MPS(msg, id, hwnd) (WPARAM)(msg), MAKELONG(hwnd, id)
  160. #define GET_WM_PARENTNOTIFY2_MPS(msg, x, y) (WPARAM)(msg), MAKELONG(x, y)
  161. #define GET_WM_VKEYTOITEM_CODE(wp, lp) (wp)
  162. #define GET_WM_VKEYTOITEM_ITEM(wp, lp) (INT)HIWORD(lp)
  163. #define GET_WM_VKEYTOITEM_HWND(wp, lp) (HWND)LOWORD(lp)
  164. #define GET_WM_VKEYTOITEM_MPS(code, item, hwnd) (WPARAM)(code), MAKELONG(hwnd, item)
  165. #define GET_EM_SETSEL_START(wp, lp) LOWORD(lp)
  166. #define GET_EM_SETSEL_END(wp, lp) HIWORD(lp)
  167. #define GET_EM_SETSEL_MPS(iStart, iEnd) 0, MAKELONG(iStart, iEnd)
  168. #define GET_EM_LINESCROLL_MPS(vert, horz) 0, MAKELONG(vert, horz)
  169. #define GET_WM_CHANGECBCHAIN_HWNDNEXT(wp, lp) (HWND)LOWORD(lp)
  170. #define GET_WM_HSCROLL_CODE(wp, lp) (wp)
  171. #define GET_WM_HSCROLL_POS(wp, lp) LOWORD(lp)
  172. #define GET_WM_HSCROLL_HWND(wp, lp) (HWND)HIWORD(lp)
  173. #define GET_WM_HSCROLL_MPS(code, pos, hwnd) (WPARAM)(code), MAKELONG(pos, hwnd)
  174. #define GET_WM_VSCROLL_CODE(wp, lp) (wp)
  175. #define GET_WM_VSCROLL_POS(wp, lp) LOWORD(lp)
  176. #define GET_WM_VSCROLL_HWND(wp, lp) (HWND)HIWORD(lp)
  177. #define GET_WM_VSCROLL_MPS(code, pos, hwnd) (WPARAM)(code), MAKELONG(pos, hwnd)
  178. #endif
  179. #endif // #ifndef WIN32