/*
 *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 *%									   %
 *%	Copyright (C) 1994 by WATCOM International Inc.		   	   %
 *%	All rights reserved.						   %
 *%									   %
 *%     Permission is granted to anyone to use this example program for	   %
 *%     any purpose on any computer system, subject to the following	   %
 *%	restrictions:							   %
 *%									   %
 *%     1. This example is provided on an "as is" basis, without warranty. %
 *%	   You indemnify, hold harmless and defend WATCOM from and against %
 *%	   any claims or lawsuits, including attorney's, that arise or	   %
 *%	   result from the use or distribution of this example, or any     %
 *%	   modification thereof.					   %
 *%									   %
 *%     2. You may not remove, alter or suppress this notice from this	   %
 *%        example program or any modification thereof.			   %
 *%									   %
 *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 */
#ifndef __WIN1632_INCLUDED__
#define __WIN1632_INCLUDED__
#ifdef __NT__

#define GET_HINSTANCE( hwnd ) (HANDLE) GetWindowLong( hwnd, GWL_HINSTANCE )
#define GET_ID( hwnd )	(DWORD) GetWindowLong( hwnd, GWL_ID )
#define GET_CBWNDEXTRA( hwnd )	(DWORD) GetClassLong( hwnd, GCL_CBWNDEXTRA )
#define GET_CLASS_STYLE(hwnd)	GetClassLong( hwnd, GCL_STYLE )

#define __FAR
#define HOOKPROC	PROC
#define WINMAINENTRY	WINAPI
#define GET_EM_SETSEL_MPS(iStart, iEnd) (UINT)(iStart), (LONG)(iEnd)
#define GET_WM_COMMAND_CMD(wp, lp)      HIWORD(wp)
#define GET_WM_COMMAND_HWND(wp, lp)     (HWND)(lp)
#define GET_WM_COMMAND_MPS(id, hwnd, cmd) (UINT)MAKELONG(id, cmd), (LONG)(hwnd)
#define GET_WM_ACTIVATE_FACTIVE(wp, lp)     LOWORD(wp)
#define GET_WM_ACTIVATE_FMINIMIZED(wp, lp)  (BOOL)HIWORD(wp)
#define GET_WM_ACTIVATE_HWND(wp, lp)        (HWND)(lp)
#define GET_WM_MDIACTIVATE_FACTIVATE(hwnd, wp, lp)  (lp == (LONG)hwnd)
#define GET_WM_MDIACTIVATE_HWNDACTIVATE(wp, lp)  (HWND)(wp)
#define GET_WM_MDIACTIVATE_HWNDDEACTIVATE(wp, lp)  (HWND)(lp)
#define GET_WM_VSCROLL_POS( wp, lp )	HIWORD(wp)
#define GET_WM_VSCROLL_HWND( wp, lp )	(HWND)(lp)
#define GET_WM_VSCROLL_CODE( wp, lp )	LOWORD(wp)
#define GET_WM_HSCROLL_POS( wp, lp )	HIWORD(wp)
#define GET_WM_HSCROLL_HWND( wp, lp )	(HWND)(lp)
#define GET_WM_HSCROLL_CODE( wp, lp )	LOWORD(wp)
#define SET_HBRBACKGROUND( hw, br ) (HBRUSH) SetClassLong( hw, GCL_HBRBACKGROUND, (LONG)br )
#define SET_HICON( hw, ic ) (HICON) SetClassLong( hw, GCL_HICON, (LONG)ic )
#define SET_CLASSCURSOR(hwnd, cur) (LONG)SetClassLong( hwnd, GCL_HCURSOR, (LONG)cur )
#define MAKE_POINT( p, pnt ) (p).x = LOWORD( pnt ), (p).y = HIWORD( pnt )
#define GET_WM_MENUSELECT_HMENU(wp,lp)	(HMENU)(lp)
#define GET_WM_MENUSELECT_ITEM(wp,lp) LOWORD(wp)
#define GET_WM_MENUSELECT_FLAGS(wp,lp) HIWORD(wp)
#define GET_WM_PARENTNOTIFY_EVENT(wp,lp) LOWORD(wp)
#define GET_WM_PARENTNOTIFY_ID(wp,lp) HIWORD(wp)
#define GET_WM_PARENTNOTIFY_HANDLE(wp,lp) (lp)
#define GET_WM_PARENTNOTIFY_POINT(wp,lp) (lp)

#else

#define GET_HINSTANCE( hwnd ) (HINSTANCE) GetWindowWord( hwnd, GWW_HINSTANCE )
#define GET_ID( hwnd )	(WORD) GetWindowWord( hwnd, GWW_ID )
#define GET_CBWNDEXTRA( hwnd )	(WORD) GetClassWord( hwnd, GCW_CBWNDEXTRA)
#define GET_CLASS_STYLE(hwnd)	GetClassWord( hwnd, GCW_STYLE )

#define APIENTRY	FAR PASCAL
#ifndef __FAR
#define __FAR		__far
#endif
#define WINMAINENTRY	PASCAL
#define GET_EM_SETSEL_MPS(iStart, iEnd) 0, MAKELONG(iStart, iEnd)
#define GET_WM_COMMAND_CMD(wp, lp)      HIWORD(lp)
#define GET_WM_COMMAND_HWND(wp, lp)     (HWND)LOWORD(lp)
#define GET_WM_COMMAND_MPS(id, hwnd, cmd) (UINT)(id), MAKELONG(hwnd, cmd)
#define GET_WM_ACTIVATE_FACTIVE(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_MDIACTIVATE_FACTIVATE(hwnd, wp, lp)  (BOOL)(wp)
#define GET_WM_MDIACTIVATE_HWNDACTIVATE(wp, lp)  (HWND)HIWORD(lp)
#define GET_WM_MDIACTIVATE_HWNDDEACTIVATE(wp, lp)  (HWND)LOWORD(lp)
#define GET_WM_VSCROLL_POS( wp, lp )	LOWORD(lp)
#define GET_WM_VSCROLL_HWND( wp, lp )	HIWORD(lp)
#define GET_WM_VSCROLL_CODE( wp, lp )	(wp)
#define GET_WM_HSCROLL_POS( wp, lp )	LOWORD(lp)
#define GET_WM_HSCROLL_HWND( wp, lp )	HIWORD(lp)
#define GET_WM_HSCROLL_CODE( wp, lp )	(wp)
#define SET_HBRBACKGROUND( hw, br ) (HBRUSH) SetClassWord( hw, GCW_HBRBACKGROUND, br )
#define SET_HICON( hw, ic ) (HICON) SetClassWord( hw, GCW_HICON, ic )
#define SET_CLASSCURSOR(hwnd, cur) (WORD)SetClassWord( hwnd, GCW_HCURSOR, cur )
#define MAKE_POINT( p, pnt ) p = MAKEPOINT( pnt )
#define GET_WM_MENUSELECT_HMENU(wp,lp) (HMENU)HIWORD(lp)
#define GET_WM_MENUSELECT_ITEM(wp,lp) (wp)
#define GET_WM_MENUSELECT_FLAGS(wp,lp) LOWORD(lp)
#define GET_WM_PARENTNOTIFY_EVENT(wp,lp) LOWORD(wp)
#define GET_WM_PARENTNOTIFY_ID(wp,lp) HIWORD(lp)
#define GET_WM_PARENTNOTIFY_HANDLE(wp,lp) LOWORD(lp)
#define GET_WM_PARENTNOTIFY_POINT(wp,lp) (lp)

#endif

#ifdef __386__
#define FARstricmp stricmp
#define FARmemcpy memcpy
#else
#define FARstricmp _fstricmp
#define FARmemcpy _fmemcpy
#endif

#undef CALLBACK
#if defined( __WINDOWS_386__ )
#define	CALLBACK	APIENTRY
#else
#define	CALLBACK	__export APIENTRY
#endif

#endif
