//==========================================================================; // // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED // TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR // A PARTICULAR PURPOSE. // // Copyright (C) 1993 - 1995 Microsoft Corporation. All Rights Reserved. // //--------------------------------------------------------------------------; // // appport.h -- Win 16/32 Portability Stuff // // Description: // This file contains common macros to help with writing code that // cross compiles between Win 32 and Win 16. This file should be // included _after_ windows.h and windowsx.h. // // History: // 11/ 8/92 created. // //==========================================================================; //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; // // Win 32 // // // //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; #ifdef WIN32 #ifndef FNLOCAL #define FNLOCAL _stdcall #define FNCLOCAL _stdcall #define FNGLOBAL _stdcall #define FNCGLOBAL _stdcall #define FNCALLBACK CALLBACK #define FNEXPORT CALLBACK #endif // #ifndef PCTSTR // typedef const PTSTR PCTSTR; // #endif // // // #define Edit_GetSelEx(hwndCtl, pnS, pnE) \ ((DWORD)SendMessage((hwndCtl), EM_GETSEL, (WPARAM)pnS, (LPARAM)pnE)) // // for compiling Unicode // #ifdef UNICODE #define SIZEOF(x) (sizeof(x)/sizeof(WCHAR)) #else #define SIZEOF(x) sizeof(x) #endif // // win32 apps [usually] don't have to worry about 'huge' data // #if !defined hmemcpy #define hmemcpy memcpy #endif #endif // #ifdef WIN32 //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; // // Win 16 // // // //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; #ifndef WIN32 #ifndef FNLOCAL #define FNLOCAL NEAR PASCAL #define FNCLOCAL NEAR _cdecl #define FNGLOBAL FAR PASCAL #define FNCGLOBAL FAR _cdecl #define FNCALLBACK CALLBACK #define FNEXPORT CALLBACK _export #endif // // stuff for Unicode in Win 32--make it a noop in Win 16 // #ifndef _TCHAR_DEFINED #define _TCHAR_DEFINED typedef char TCHAR, *PTCHAR; typedef unsigned char TBYTE, *PTUCHAR; typedef PSTR PTSTR, PTCH; typedef const PTSTR PCTSTR; typedef LPSTR LPTSTR, LPTCH; typedef LPCSTR LPCTSTR; #endif #define TEXT(a) a #define SIZEOF(x) sizeof(x) // // // #define CharNext AnsiNext #define CharPrev AnsiPrev // // // #define Edit_GetSelEx(hwndCtl, pnS, pnE) \ { \ DWORD dw; \ dw = (DWORD)SendMessage((hwndCtl), EM_GETSEL, 0, 0L); \ *pnE = (int)HIWORD(dw); \ *pnS = (int)LOWORD(dw); \ } // // common message cracker macros available in windowx.h on NT--these // should be added to the Win 16 windowsx.h and probably will be // in the future. // // there is a windowsx.h16 that ships with the NT PDK that defines // these macros. so if that version is being used, don't redefine // message crackers. // #ifndef WM_CTLCOLORMSGBOX #define WM_CTLCOLORMSGBOX 0x0132 #define WM_CTLCOLOREDIT 0x0133 #define WM_CTLCOLORLISTBOX 0x0134 #define WM_CTLCOLORBTN 0x0135 #define WM_CTLCOLORDLG 0x0136 #define WM_CTLCOLORSCROLLBAR 0x0137 #define WM_CTLCOLORSTATIC 0x0138 #endif #ifndef GET_WM_ACTIVATE_STATE #define GET_WM_ACTIVATE_STATE(wp, lp) (wp) #define GET_WM_ACTIVATE_FMINIMIZED(wp, lp) (BOOL)HIWORD(lp) #define GET_WM_ACTIVATE_HWND(wp, lp) (HWND)LOWORD(lp) #define GET_WM_ACTIVATE_MPS(s, fmin, hwnd) (WPARAM)(s), MAKELONG(hwnd, fmin) #define GET_WM_CHARTOITEM_CHAR(wp, lp) (CHAR)(wp) #define GET_WM_CHARTOITEM_POS(wp, lp) HIWORD(lp) #define GET_WM_CHARTOITEM_HWND(wp, lp) (HWND)LOWORD(lp) #define GET_WM_CHARTOITEM_MPS(ch, pos, hwnd) (WPARAM)(ch), MAKELONG(hwnd, pos) #define GET_WM_COMMAND_ID(wp, lp) (wp) #define GET_WM_COMMAND_HWND(wp, lp) (HWND)LOWORD(lp) #define GET_WM_COMMAND_CMD(wp, lp) HIWORD(lp) #define GET_WM_COMMAND_MPS(id, hwnd, cmd) (WPARAM)(id), MAKELONG(hwnd, cmd) #define GET_WM_CTLCOLOR_HDC(wp, lp, msg) (HDC)(wp) #define GET_WM_CTLCOLOR_HWND(wp, lp, msg) (HWND)LOWORD(lp) #define GET_WM_CTLCOLOR_TYPE(wp, lp, msg) HIWORD(lp) #define GET_WM_CTLCOLOR_MPS(hdc, hwnd, type) (WPARAM)(hdc), MAKELONG(hwnd, type) #define GET_WM_MENUSELECT_CMD(wp, lp) (wp) #define GET_WM_MENUSELECT_FLAGS(wp, lp) LOWORD(lp) #define GET_WM_MENUSELECT_HMENU(wp, lp) (HMENU)HIWORD(lp) #define GET_WM_MENUSELECT_MPS(cmd, f, hmenu) (WPARAM)(cmd), MAKELONG(f, hmenu) // Note: the following are for interpreting MDIclient to MDI child messages. #define GET_WM_MDIACTIVATE_FACTIVATE(hwnd, wp, lp) (BOOL)(wp) #define GET_WM_MDIACTIVATE_HWNDDEACT(wp, lp) (HWND)HIWORD(lp) #define GET_WM_MDIACTIVATE_HWNDACTIVATE(wp, lp) (HWND)LOWORD(lp) // Note: the following is for sending to the MDI client window. #define GET_WM_MDIACTIVATE_MPS(f, hwndD, hwndA) (WPARAM)(hwndA), 0 #define GET_WM_MDISETMENU_MPS(hmenuF, hmenuW) 0, MAKELONG(hmenuF, hmenuW) #define GET_WM_MENUCHAR_CHAR(wp, lp) (CHAR)(wp) #define GET_WM_MENUCHAR_HMENU(wp, lp) (HMENU)LOWORD(lp) #define GET_WM_MENUCHAR_FMENU(wp, lp) (BOOL)HIWORD(lp) #define GET_WM_MENUCHAR_MPS(ch, hmenu, f) (WPARAM)(ch), MAKELONG(hmenu, f) #define GET_WM_PARENTNOTIFY_MSG(wp, lp) (wp) #define GET_WM_PARENTNOTIFY_ID(wp, lp) HIWORD(lp) #define GET_WM_PARENTNOTIFY_HWNDCHILD(wp, lp) (HWND)LOWORD(lp) #define GET_WM_PARENTNOTIFY_X(wp, lp) (INT)LOWORD(lp) #define GET_WM_PARENTNOTIFY_Y(wp, lp) (INT)HIWORD(lp) #define GET_WM_PARENTNOTIFY_MPS(msg, id, hwnd) (WPARAM)(msg), MAKELONG(hwnd, id) #define GET_WM_PARENTNOTIFY2_MPS(msg, x, y) (WPARAM)(msg), MAKELONG(x, y) #define GET_WM_VKEYTOITEM_CODE(wp, lp) (wp) #define GET_WM_VKEYTOITEM_ITEM(wp, lp) (INT)HIWORD(lp) #define GET_WM_VKEYTOITEM_HWND(wp, lp) (HWND)LOWORD(lp) #define GET_WM_VKEYTOITEM_MPS(code, item, hwnd) (WPARAM)(code), MAKELONG(hwnd, item) #define GET_EM_SETSEL_START(wp, lp) LOWORD(lp) #define GET_EM_SETSEL_END(wp, lp) HIWORD(lp) #define GET_EM_SETSEL_MPS(iStart, iEnd) 0, MAKELONG(iStart, iEnd) #define GET_EM_LINESCROLL_MPS(vert, horz) 0, MAKELONG(vert, horz) #define GET_WM_CHANGECBCHAIN_HWNDNEXT(wp, lp) (HWND)LOWORD(lp) #define GET_WM_HSCROLL_CODE(wp, lp) (wp) #define GET_WM_HSCROLL_POS(wp, lp) LOWORD(lp) #define GET_WM_HSCROLL_HWND(wp, lp) (HWND)HIWORD(lp) #define GET_WM_HSCROLL_MPS(code, pos, hwnd) (WPARAM)(code), MAKELONG(pos, hwnd) #define GET_WM_VSCROLL_CODE(wp, lp) (wp) #define GET_WM_VSCROLL_POS(wp, lp) LOWORD(lp) #define GET_WM_VSCROLL_HWND(wp, lp) (HWND)HIWORD(lp) #define GET_WM_VSCROLL_MPS(code, pos, hwnd) (WPARAM)(code), MAKELONG(pos, hwnd) #endif #endif // #ifndef WIN32