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.

215 lines
7.7 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 - 1995 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. // #ifndef PCTSTR
  40. // typedef const PTSTR PCTSTR;
  41. // #endif
  42. //
  43. //
  44. //
  45. #define Edit_GetSelEx(hwndCtl, pnS, pnE) \
  46. ((DWORD)SendMessage((hwndCtl), EM_GETSEL, (WPARAM)pnS, (LPARAM)pnE))
  47. //
  48. // for compiling Unicode
  49. //
  50. #ifdef UNICODE
  51. #define SIZEOF(x) (sizeof(x)/sizeof(WCHAR))
  52. #else
  53. #define SIZEOF(x) sizeof(x)
  54. #endif
  55. //
  56. // win32 apps [usually] don't have to worry about 'huge' data
  57. //
  58. #if !defined hmemcpy
  59. #define hmemcpy memcpy
  60. #endif
  61. #endif // #ifdef WIN32
  62. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  63. //
  64. // Win 16
  65. //
  66. //
  67. //
  68. //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;
  69. #ifndef WIN32
  70. #ifndef FNLOCAL
  71. #define FNLOCAL NEAR PASCAL
  72. #define FNCLOCAL NEAR _cdecl
  73. #define FNGLOBAL FAR PASCAL
  74. #define FNCGLOBAL FAR _cdecl
  75. #define FNCALLBACK CALLBACK
  76. #define FNEXPORT CALLBACK _export
  77. #endif
  78. //
  79. // stuff for Unicode in Win 32--make it a noop in Win 16
  80. //
  81. #ifndef _TCHAR_DEFINED
  82. #define _TCHAR_DEFINED
  83. typedef char TCHAR, *PTCHAR;
  84. typedef unsigned char TBYTE, *PTUCHAR;
  85. typedef PSTR PTSTR, PTCH;
  86. typedef const PTSTR PCTSTR;
  87. typedef LPSTR LPTSTR, LPTCH;
  88. typedef LPCSTR LPCTSTR;
  89. #endif
  90. #define TEXT(a) a
  91. #define SIZEOF(x) sizeof(x)
  92. //
  93. //
  94. //
  95. #define CharNext AnsiNext
  96. #define CharPrev AnsiPrev
  97. //
  98. //
  99. //
  100. #define Edit_GetSelEx(hwndCtl, pnS, pnE) \
  101. { \
  102. DWORD dw; \
  103. dw = (DWORD)SendMessage((hwndCtl), EM_GETSEL, 0, 0L); \
  104. *pnE = (int)HIWORD(dw); \
  105. *pnS = (int)LOWORD(dw); \
  106. }
  107. //
  108. // common message cracker macros available in windowx.h on NT--these
  109. // should be added to the Win 16 windowsx.h and probably will be
  110. // in the future.
  111. //
  112. // there is a windowsx.h16 that ships with the NT PDK that defines
  113. // these macros. so if that version is being used, don't redefine
  114. // message crackers.
  115. //
  116. #ifndef WM_CTLCOLORMSGBOX
  117. #define WM_CTLCOLORMSGBOX 0x0132
  118. #define WM_CTLCOLOREDIT 0x0133
  119. #define WM_CTLCOLORLISTBOX 0x0134
  120. #define WM_CTLCOLORBTN 0x0135
  121. #define WM_CTLCOLORDLG 0x0136
  122. #define WM_CTLCOLORSCROLLBAR 0x0137
  123. #define WM_CTLCOLORSTATIC 0x0138
  124. #endif
  125. #ifndef GET_WM_ACTIVATE_STATE
  126. #define GET_WM_ACTIVATE_STATE(wp, lp) (wp)
  127. #define GET_WM_ACTIVATE_FMINIMIZED(wp, lp) (BOOL)HIWORD(lp)
  128. #define GET_WM_ACTIVATE_HWND(wp, lp) (HWND)LOWORD(lp)
  129. #define GET_WM_ACTIVATE_MPS(s, fmin, hwnd) (WPARAM)(s), MAKELONG(hwnd, fmin)
  130. #define GET_WM_CHARTOITEM_CHAR(wp, lp) (CHAR)(wp)
  131. #define GET_WM_CHARTOITEM_POS(wp, lp) HIWORD(lp)
  132. #define GET_WM_CHARTOITEM_HWND(wp, lp) (HWND)LOWORD(lp)
  133. #define GET_WM_CHARTOITEM_MPS(ch, pos, hwnd) (WPARAM)(ch), MAKELONG(hwnd, pos)
  134. #define GET_WM_COMMAND_ID(wp, lp) (wp)
  135. #define GET_WM_COMMAND_HWND(wp, lp) (HWND)LOWORD(lp)
  136. #define GET_WM_COMMAND_CMD(wp, lp) HIWORD(lp)
  137. #define GET_WM_COMMAND_MPS(id, hwnd, cmd) (WPARAM)(id), MAKELONG(hwnd, cmd)
  138. #define GET_WM_CTLCOLOR_HDC(wp, lp, msg) (HDC)(wp)
  139. #define GET_WM_CTLCOLOR_HWND(wp, lp, msg) (HWND)LOWORD(lp)
  140. #define GET_WM_CTLCOLOR_TYPE(wp, lp, msg) HIWORD(lp)
  141. #define GET_WM_CTLCOLOR_MPS(hdc, hwnd, type) (WPARAM)(hdc), MAKELONG(hwnd, type)
  142. #define GET_WM_MENUSELECT_CMD(wp, lp) (wp)
  143. #define GET_WM_MENUSELECT_FLAGS(wp, lp) LOWORD(lp)
  144. #define GET_WM_MENUSELECT_HMENU(wp, lp) (HMENU)HIWORD(lp)
  145. #define GET_WM_MENUSELECT_MPS(cmd, f, hmenu) (WPARAM)(cmd), MAKELONG(f, hmenu)
  146. // Note: the following are for interpreting MDIclient to MDI child messages.
  147. #define GET_WM_MDIACTIVATE_FACTIVATE(hwnd, wp, lp) (BOOL)(wp)
  148. #define GET_WM_MDIACTIVATE_HWNDDEACT(wp, lp) (HWND)HIWORD(lp)
  149. #define GET_WM_MDIACTIVATE_HWNDACTIVATE(wp, lp) (HWND)LOWORD(lp)
  150. // Note: the following is for sending to the MDI client window.
  151. #define GET_WM_MDIACTIVATE_MPS(f, hwndD, hwndA) (WPARAM)(hwndA), 0
  152. #define GET_WM_MDISETMENU_MPS(hmenuF, hmenuW) 0, MAKELONG(hmenuF, hmenuW)
  153. #define GET_WM_MENUCHAR_CHAR(wp, lp) (CHAR)(wp)
  154. #define GET_WM_MENUCHAR_HMENU(wp, lp) (HMENU)LOWORD(lp)
  155. #define GET_WM_MENUCHAR_FMENU(wp, lp) (BOOL)HIWORD(lp)
  156. #define GET_WM_MENUCHAR_MPS(ch, hmenu, f) (WPARAM)(ch), MAKELONG(hmenu, f)
  157. #define GET_WM_PARENTNOTIFY_MSG(wp, lp) (wp)
  158. #define GET_WM_PARENTNOTIFY_ID(wp, lp) HIWORD(lp)
  159. #define GET_WM_PARENTNOTIFY_HWNDCHILD(wp, lp) (HWND)LOWORD(lp)
  160. #define GET_WM_PARENTNOTIFY_X(wp, lp) (INT)LOWORD(lp)
  161. #define GET_WM_PARENTNOTIFY_Y(wp, lp) (INT)HIWORD(lp)
  162. #define GET_WM_PARENTNOTIFY_MPS(msg, id, hwnd) (WPARAM)(msg), MAKELONG(hwnd, id)
  163. #define GET_WM_PARENTNOTIFY2_MPS(msg, x, y) (WPARAM)(msg), MAKELONG(x, y)
  164. #define GET_WM_VKEYTOITEM_CODE(wp, lp) (wp)
  165. #define GET_WM_VKEYTOITEM_ITEM(wp, lp) (INT)HIWORD(lp)
  166. #define GET_WM_VKEYTOITEM_HWND(wp, lp) (HWND)LOWORD(lp)
  167. #define GET_WM_VKEYTOITEM_MPS(code, item, hwnd) (WPARAM)(code), MAKELONG(hwnd, item)
  168. #define GET_EM_SETSEL_START(wp, lp) LOWORD(lp)
  169. #define GET_EM_SETSEL_END(wp, lp) HIWORD(lp)
  170. #define GET_EM_SETSEL_MPS(iStart, iEnd) 0, MAKELONG(iStart, iEnd)
  171. #define GET_EM_LINESCROLL_MPS(vert, horz) 0, MAKELONG(vert, horz)
  172. #define GET_WM_CHANGECBCHAIN_HWNDNEXT(wp, lp) (HWND)LOWORD(lp)
  173. #define GET_WM_HSCROLL_CODE(wp, lp) (wp)
  174. #define GET_WM_HSCROLL_POS(wp, lp) LOWORD(lp)
  175. #define GET_WM_HSCROLL_HWND(wp, lp) (HWND)HIWORD(lp)
  176. #define GET_WM_HSCROLL_MPS(code, pos, hwnd) (WPARAM)(code), MAKELONG(pos, hwnd)
  177. #define GET_WM_VSCROLL_CODE(wp, lp) (wp)
  178. #define GET_WM_VSCROLL_POS(wp, lp) LOWORD(lp)
  179. #define GET_WM_VSCROLL_HWND(wp, lp) (HWND)HIWORD(lp)
  180. #define GET_WM_VSCROLL_MPS(code, pos, hwnd) (WPARAM)(code), MAKELONG(pos, hwnd)
  181. #endif
  182. #endif // #ifndef WIN32