Release 961013

Sun Oct 13 15:32:32 1996  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [Make.rules.in] [*/Makefile.in]
	Made it possible to compile from a directory other than the source
	directory.

	* [graphics/metafiledrv/init.c] [include/metafiledrv.h]
	  [objects/metafile.c] [objects/dc.c]
	New graphics driver for metafiles.

	* [if1632/thunk.c]
	Added thunks for SetWindowsHook and SetDCHook.

	* [windows/dialog.c]
	Fixed GetNextDlgGroupItem and GetNextDlgTabItem to skip disabled
	items.

	* [*/*]
	Removed non Win32-clean types HANDLE, HBITMAP, HBRUSH, HFONT,
 	HINSTANCE, HMENU, HRGN and HTASK.

Wed Oct  9 14:59:45 1996  Frans van Dorsselaer  <dorssel@rulhm1.LeidenUniv.nl>

	* [controls/edit.c]
	Fixed EditWndProc() to fall back to DefWndProc() when the
	edit state structure is not available.

Wed Oct  2 14:00:34 1996  Huw D. M. Davies  <h.davies1@physics.oxford.ac.uk>

	* [windows/nonclient.c] [windows/mdi.c]
	AdjustWindowRectEx16() should only take notice of the styles
 	WS_DLGFRAME, WS_BORDER, WS_THICKFRAME and
 	WS_EX_DLGMODALFRAME. Thanks to Alex Korobka.

	* [controls/scroll.c]
	Fixed typo in ShowScrollBar32().

Sun Aug 25 20:18:56 1996  Jukka Iivonen <iivonen@cc.helsinki.fi>

	* [if1632/user32.spec] [if1632/winmm.spec]
	Added SetParent and sndPlaySoundA.
diff --git a/controls/Makefile.in b/controls/Makefile.in
index 0b99780..09188b5 100644
--- a/controls/Makefile.in
+++ b/controls/Makefile.in
@@ -1,6 +1,9 @@
-DEFS   = -D__WINE__
-TOPSRC = @top_srcdir@
-MODULE = controls
+DEFS      = -D__WINE__
+TOPSRCDIR = @top_srcdir@
+TOPOBJDIR = ..
+SRCDIR    = @srcdir@
+VPATH     = @srcdir@
+MODULE    = controls
 
 C_SRCS = \
 	button.c \
diff --git a/controls/button.c b/controls/button.c
index d224256..4ccf659 100644
--- a/controls/button.c
+++ b/controls/button.c
@@ -11,7 +11,7 @@
 #include "button.h"
 
 static void PB_Paint( WND *wndPtr, HDC32 hDC, WORD action );
-static void PB_PaintGrayOnGray(HDC32 hDC,HFONT hFont,RECT32 *rc,char *text);
+static void PB_PaintGrayOnGray(HDC32 hDC,HFONT32 hFont,RECT32 *rc,char *text);
 static void CB_Paint( WND *wndPtr, HDC32 hDC, WORD action );
 static void GB_Paint( WND *wndPtr, HDC32 hDC, WORD action );
 static void UB_Paint( WND *wndPtr, HDC32 hDC, WORD action );
@@ -64,7 +64,7 @@
     SendMessage32A( GetParent32((wndPtr)->hwndSelf), WM_CTLCOLORBTN, \
                     (hdc), (wndPtr)->hwndSelf )
 
-static HBITMAP hbitmapCheckBoxes = 0;
+static HBITMAP16 hbitmapCheckBoxes = 0;
 static WORD checkBoxWidth = 0, checkBoxHeight = 0;
 
 
@@ -173,7 +173,7 @@
         return 0;
 
     case WM_SETFONT:
-        infoPtr->hFont = (HFONT) wParam;
+        infoPtr->hFont = (HFONT16)wParam;
         if (lParam) PAINT_BUTTON( wndPtr, style, ODA_DRAWENTIRE );
         break;
 
@@ -253,7 +253,7 @@
 {
     RECT32 rc;
     HPEN16 hOldPen;
-    HBRUSH hOldBrush;
+    HBRUSH16 hOldBrush;
     BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra;
 
     GetClientRect32( wndPtr->hwndSelf, &rc );
@@ -262,7 +262,7 @@
     if (infoPtr->hFont) SelectObject( hDC, infoPtr->hFont );
     BUTTON_SEND_CTLCOLOR( wndPtr, hDC );
     hOldPen = (HPEN16)SelectObject(hDC, sysColorObjects.hpenWindowFrame);
-    hOldBrush = (HBRUSH)SelectObject(hDC, sysColorObjects.hbrushBtnFace);
+    hOldBrush = (HBRUSH16)SelectObject(hDC, sysColorObjects.hbrushBtnFace);
     SetBkMode(hDC, TRANSPARENT);
     Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom);
     if (action == ODA_DRAWENTIRE)
@@ -334,13 +334,13 @@
  *   using a raster brush to avoid gray text on gray background
  */
 
-void PB_PaintGrayOnGray(HDC32 hDC,HFONT hFont,RECT32 *rc,char *text)
+void PB_PaintGrayOnGray(HDC32 hDC,HFONT32 hFont,RECT32 *rc,char *text)
 {
     static int Pattern[] = {0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55};
-    HBITMAP hbm  = CreateBitmap(8, 8, 1, 1, Pattern);
+    HBITMAP16 hbm  = CreateBitmap(8, 8, 1, 1, Pattern);
     HDC hdcMem   = CreateCompatibleDC(hDC);
-    HBITMAP hbmMem;
-    HBRUSH hBr;
+    HBITMAP16 hbmMem;
+    HBRUSH16 hBr;
     RECT32 rect,rc2;
 
     rect=*rc;
@@ -370,7 +370,7 @@
 static void CB_Paint( WND *wndPtr, HDC32 hDC, WORD action )
 {
     RECT16 rc;
-    HBRUSH hBrush;
+    HBRUSH16 hBrush;
     int textlen, delta, x, y;
     TEXTMETRIC16 tm;
     BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra;
@@ -431,12 +431,12 @@
  */
 static void BUTTON_CheckAutoRadioButton( WND *wndPtr )
 {
-    HWND parent, sibling;
+    HWND32 parent, sibling;
     if (!(wndPtr->dwStyle & WS_CHILD)) return;
     parent = wndPtr->parent->hwndSelf;
-    for(sibling = GetNextDlgGroupItem(parent,wndPtr->hwndSelf,FALSE);
+    for(sibling = GetNextDlgGroupItem32( parent, wndPtr->hwndSelf, FALSE );
         sibling != wndPtr->hwndSelf;
-        sibling = GetNextDlgGroupItem(parent,sibling,FALSE))
+        sibling = GetNextDlgGroupItem32( parent, sibling, FALSE ))
 	    SendMessage32A( sibling, BM_SETCHECK32, BUTTON_UNCHECKED, 0 );
 }
 
@@ -479,7 +479,7 @@
 static void UB_Paint( WND *wndPtr, HDC32 hDC, WORD action )
 {
     RECT16 rc;
-    HBRUSH hBrush;
+    HBRUSH16 hBrush;
     BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra;
 
     if (action == ODA_SELECT) return;
diff --git a/controls/combo.c b/controls/combo.c
index 412fb2e..917ab1b 100644
--- a/controls/combo.c
+++ b/controls/combo.c
@@ -42,7 +42,7 @@
 static BOOL CBCheckSize(HWND hwnd);
 static BOOL CBLCheckSize(HWND hwnd);
 
-static HBITMAP hComboBit = 0;
+static HBITMAP16 hComboBit = 0;
 static WORD CBitHeight, CBitWidth;
 
 static int COMBO_Init()
@@ -175,7 +175,7 @@
 				  WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | ES_LEFT,
 				  0, 0, rect.right-6-CBitWidth,
 				  lphl->StdItemHeight+2*SYSMETRICS_CYBORDER,
-				  hwnd, (HMENU)ID_EDIT, WIN_GetWindowInstance(hwnd), NULL );
+				  hwnd, (HMENU16)ID_EDIT, WIN_GetWindowInstance(hwnd), NULL );
 				  
   lboxrect.top+=lphc->LBoxTop;
   lphc->hWndLBox = CreateWindow16( className, NULL, style |
@@ -184,7 +184,7 @@
 				lboxrect.left, lboxrect.top,
 				lboxrect.right - lboxrect.left, 
 				lboxrect.bottom - lboxrect.top,
-				hwndp,(HMENU)ID_CLB, WIN_GetWindowInstance(hwnd),
+				hwndp,(HMENU16)ID_CLB, WIN_GetWindowInstance(hwnd),
 				(LPVOID)(HWND32)hwnd );
 
    wndPtr->dwStyle &= ~(WS_VSCROLL | WS_HSCROLL);
@@ -224,8 +224,8 @@
   LPHEADCOMBO lphc = ComboGetStorageHeader(hwnd);
   LPLISTSTRUCT lpls;
   PAINTSTRUCT16  ps;
-  HBRUSH hBrush;
-  HFONT  hOldFont;
+  HBRUSH16 hBrush;
+  HFONT16  hOldFont;
   HDC16 hdc;
   RECT16 rect;
   
@@ -558,7 +558,7 @@
   if (wParam == 0)
     lphl->hFont = GetStockObject(SYSTEM_FONT);
   else
-    lphl->hFont = (HFONT)wParam;
+    lphl->hFont = (HFONT16)wParam;
   if (lphc->hWndEdit)
      SendMessage16(lphc->hWndEdit,WM_SETFONT,lphl->hFont,0); 
   return 0;
@@ -914,8 +914,8 @@
   LPHEADLIST   lphl = CLBoxGetListHeader(hwnd);
   LPLISTSTRUCT lpls;
   PAINTSTRUCT16  ps;
-  HBRUSH       hBrush;
-  HFONT        hOldFont;
+  HBRUSH16 hBrush;
+  HFONT16 hOldFont;
   WND * wndPtr = WIN_FindWndPtr(hwnd);
   HWND  combohwnd = CLBoxGetCombo(hwnd);
   HDC16 hdc;
diff --git a/controls/edit.c b/controls/edit.c
index fb87a79..a5e811e 100644
--- a/controls/edit.c
+++ b/controls/edit.c
@@ -49,7 +49,7 @@
 	UINT TextWidth;		/* width of the widest line in pixels */
 	HLOCAL16 hBuf;
 	char *text;
-	HFONT hFont;
+	HFONT16 hFont;
 	LINEDEF *LineDefs;
 	UINT XOffset;		/* offset of the viewport in pixels */
 	UINT FirstVisibleLine;
@@ -240,6 +240,9 @@
 	LRESULT lResult = 0L;
 	WND *wndPtr = WIN_FindWndPtr(hwnd);
 
+	if ((!EDITSTATEPTR(wndPtr)) && (msg != WM_CREATE))
+		return DefWindowProc16(hwnd, msg, wParam, lParam);
+
 	switch (msg) {
 	case EM_CANUNDO:
 		DPRINTF_EDIT_MSG("EM_CANUNDO");
@@ -504,8 +507,8 @@
 	char *text = EDIT_GetPasswordPointer(wndPtr);
 	int ww = EDIT_GetWndWidth(wndPtr);
 	HDC32 hdc;
-	HFONT hFont;
-	HFONT oldFont = 0;
+	HFONT16 hFont;
+	HFONT16 oldFont = 0;
 	char *start, *cp;
 	int prev, next;
 	int width;
@@ -513,7 +516,7 @@
 	LINE_END ending;
 
 	hdc = GetDC32(wndPtr->hwndSelf);
-	hFont = (HFONT)EDIT_WM_GetFont(wndPtr, 0, 0L);
+	hFont = (HFONT16)EDIT_WM_GetFont(wndPtr, 0, 0L);
 	if (hFont)
 		oldFont = SelectObject(hdc, hFont);
 
@@ -1442,15 +1445,15 @@
 	char *text = EDIT_GetPasswordPointer(wndPtr);
 	INT ret;
 	HDC32 hdc;
-	HFONT hFont;
-	HFONT oldFont = 0;
+	HFONT16 hFont;
+	HFONT16 oldFont = 0;
 	UINT lc = (UINT)EDIT_EM_GetLineCount(wndPtr, 0, 0L);
 	UINT li = (UINT)EDIT_EM_LineIndex(wndPtr, line, 0L);
 	UINT ll = (UINT)EDIT_EM_LineLength(wndPtr, li, 0L);
 	UINT xoff = EDIT_GetXOffset(wndPtr);
 
 	hdc = GetDC32(wndPtr->hwndSelf);
-	hFont = (HFONT)EDIT_WM_GetFont(wndPtr, 0, 0L);
+	hFont = (HFONT16)EDIT_WM_GetFont(wndPtr, 0, 0L);
 	if (hFont)
 		oldFont = SelectObject(hdc, hFont);
 	line = MAX(0, MIN(line, lc - 1));
@@ -2311,12 +2314,12 @@
  */
 static LRESULT EDIT_WM_EraseBkGnd(WND *wndPtr, WPARAM wParam, LPARAM lParam)
 {
-	HBRUSH hBrush;
+	HBRUSH16 hBrush;
 	RECT16 rc;
 
-	hBrush = (HBRUSH)EDIT_SEND_CTLCOLOR(wndPtr, wParam);
+	hBrush = (HBRUSH16)EDIT_SEND_CTLCOLOR(wndPtr, wParam);
 	if (!hBrush)
-		hBrush = (HBRUSH)GetStockObject(WHITE_BRUSH);
+		hBrush = (HBRUSH16)GetStockObject(WHITE_BRUSH);
 
 	GetClientRect16(wndPtr->hwndSelf, &rc);
 	IntersectClipRect((HDC)wParam, rc.left, rc.top, rc.right, rc.bottom);
@@ -2678,8 +2681,8 @@
 	UINT vlc = EDIT_GetVisibleLineCount(wndPtr);
 	UINT lc = (UINT)EDIT_EM_GetLineCount(wndPtr, 0, 0L);
 	HDC16 hdc;
-	HFONT hFont;
-	HFONT oldFont = 0;
+	HFONT16 hFont;
+	HFONT16 oldFont = 0;
 	RECT16 rc;
 	RECT16 rcLine;
 	RECT16 rcRgn;
@@ -2776,9 +2779,9 @@
 	EDITSTATE *es = EDITSTATEPTR(wndPtr);
 	LPARAM sel = EDIT_EM_GetSel(wndPtr, 0, 0L);
 	HDC32 hdc;
-	HFONT oldFont = 0;
+	HFONT16 oldFont = 0;
 
-	es->hFont = (HFONT)wParam;
+	es->hFont = (HFONT16)wParam;
 	hdc = GetDC32(wndPtr->hwndSelf);
 	if (es->hFont)
 		oldFont = SelectObject(hdc, es->hFont);
diff --git a/controls/listbox.c b/controls/listbox.c
index 4abf763..f39cfdc 100644
--- a/controls/listbox.c
+++ b/controls/listbox.c
@@ -430,7 +430,7 @@
 int ListBoxInsertString(LPHEADLIST lphl, UINT uIndex, LPCSTR newstr)
 {
   LPLISTSTRUCT *lppls, lplsnew, lpls;
-  HANDLE       hStr;
+  HANDLE16 hStr;
   LPSTR	str;
   UINT	Count;
     
@@ -1408,7 +1408,7 @@
   if (wParam == 0)
     lphl->hFont = GetStockObject(SYSTEM_FONT);
   else
-    lphl->hFont = (HFONT) wParam;
+    lphl->hFont = (HFONT16)wParam;
 
   /* a new font means possible new text height */
   /* does this mean the height of each entry must be separately changed? */
@@ -1434,8 +1434,8 @@
   LPHEADLIST   lphl = ListBoxGetStorageHeader(hwnd);
   LPLISTSTRUCT lpls;
   PAINTSTRUCT16 ps;
-  HBRUSH       hBrush;
-  HFONT        hOldFont;
+  HBRUSH16 hBrush;
+  HFONT16 hOldFont;
   HDC16 hdc    = BeginPaint16( hwnd, &ps );
   DC    *dc    = (DC *)GDI_GetObjPtr(hdc, DC_MAGIC);
   RECT16  rect, paintRect, scratchRect;
@@ -1454,8 +1454,8 @@
 
   hOldFont = SelectObject(hdc, lphl->hFont);
 
-  hBrush = (HBRUSH)SendMessage32A( lphl->hParent, WM_CTLCOLORLISTBOX,
-                                   (WPARAM)hdc, (LPARAM)hwnd);
+  hBrush = (HBRUSH16)SendMessage32A( lphl->hParent, WM_CTLCOLORLISTBOX,
+                                     (WPARAM)hdc, (LPARAM)hwnd);
   if (hBrush == 0) hBrush = GetStockObject(WHITE_BRUSH);
 
   FillRect16(hdc, &rect, hBrush);
@@ -1536,7 +1536,7 @@
        if( lphl->ItemsCount && lphl->ItemFocused != -1)
          {
            HDC32        hDC = GetDC32(hwnd);
-           HFONT        hOldFont = SelectObject(hDC, lphl->hFont);
+           HFONT16      hOldFont = SelectObject(hDC, lphl->hFont);
            LPLISTSTRUCT lpls;
 
            lpls = ListBoxGetItem(lphl,lphl->ItemFocused);
@@ -1566,7 +1566,7 @@
            if( lphl->ItemFocused != -1 )
              {
               HDC32        hDC = GetDC32(hwnd);
-              HFONT        hOldFont = SelectObject(hDC, lphl->hFont);
+              HFONT16      hOldFont = SelectObject(hDC, lphl->hFont);
               LPLISTSTRUCT lpls;
 
               lpls = ListBoxGetItem(lphl,lphl->ItemFocused);
diff --git a/controls/menu.c b/controls/menu.c
index d18b3ca..c01dfcb 100644
--- a/controls/menu.c
+++ b/controls/menu.c
@@ -39,8 +39,8 @@
     UINT	item_id;       /* Item or popup id */
     RECT16      rect;          /* Item area (relative to menu window) */
     WORD        xTab;          /* X position of text after Tab */
-    HBITMAP	hCheckBit;     /* Bitmap for checked item */
-    HBITMAP	hUnCheckBit;   /* Bitmap for unchecked item */
+    HBITMAP16	hCheckBit;     /* Bitmap for checked item */
+    HBITMAP16	hUnCheckBit;   /* Bitmap for unchecked item */
     LPSTR       text;          /* Item text or bitmap handle */
 } MENUITEM;
 
@@ -49,7 +49,7 @@
 {
     WORD        wFlags;       /* Menu flags (MF_POPUP, MF_SYSMENU) */
     WORD        wMagic;       /* Magic number */
-    HANDLE      hTaskQ;       /* Task queue for this menu */
+    HQUEUE16    hTaskQ;       /* Task queue for this menu */
     WORD	Width;        /* Width of the whole menu */
     WORD	Height;       /* Height of the whole menu */
     WORD	nItems;       /* Number of items in the menu */
@@ -89,11 +89,11 @@
 
 extern void  NC_DrawSysButton(HWND hwnd, HDC hdc, BOOL down); /* nonclient.c */
 extern BOOL  NC_GetSysPopupPos(WND* wndPtr, RECT16* rect);
-extern HTASK TASK_GetNextTask(HTASK);
+extern HTASK16 TASK_GetNextTask(HTASK16);
 
-static HBITMAP hStdCheck = 0;
-static HBITMAP hStdMnArrow = 0;
-static HMENU MENU_DefSysMenu = 0;  /* Default system menu */
+static HBITMAP16 hStdCheck = 0;
+static HBITMAP16 hStdMnArrow = 0;
+static HMENU16 MENU_DefSysMenu = 0;  /* Default system menu */
 
 
 /* we _can_ use global popup window because there's no way 2 menues can
@@ -109,9 +109,9 @@
  *
  * Load a copy of the system menu.
  */
-static HMENU MENU_CopySysMenu(void)
+static HMENU16 MENU_CopySysMenu(void)
 {
-    HMENU hMenu;
+    HMENU16 hMenu;
     HGLOBAL16 handle;
     POPUPMENU *menu;
 
@@ -166,7 +166,7 @@
  *
  * Return the default system menu.
  */
-HMENU MENU_GetDefSysMenu(void)
+HMENU16 MENU_GetDefSysMenu(void)
 {
     return MENU_DefSysMenu;
 }
@@ -215,7 +215,7 @@
  *
  * Grey the appropriate items in System menu.
  */
-void MENU_InitSysMenuPopup(HMENU hmenu, DWORD style, DWORD clsStyle)
+void MENU_InitSysMenuPopup(HMENU16 hmenu, DWORD style, DWORD clsStyle)
 {
     BOOL gray;
 
@@ -240,7 +240,7 @@
  * Find a menu item. Return a pointer on the item, and modifies *hmenu
  * in case the item was in a sub-menu.
  */
-static MENUITEM *MENU_FindItem( HMENU *hmenu, UINT *nPos, UINT wFlags )
+static MENUITEM *MENU_FindItem( HMENU16 *hmenu, UINT *nPos, UINT wFlags )
 {
     POPUPMENU *menu;
     int i;
@@ -263,7 +263,7 @@
 	    }
 	    else if (item->item_flags & MF_POPUP)
 	    {
-		HMENU hsubmenu = (HMENU)item->item_id;
+		HMENU16 hsubmenu = (HMENU16)item->item_id;
 		MENUITEM *subitem = MENU_FindItem( &hsubmenu, nPos, wFlags );
 		if (subitem)
 		{
@@ -311,7 +311,7 @@
  * Find the menu item selected by a key press.
  * Return item id, -1 if none, -2 if we should close the menu.
  */
-static UINT MENU_FindItemByKey( HWND hwndOwner, HMENU hmenu, UINT key )
+static UINT MENU_FindItemByKey( HWND hwndOwner, HMENU16 hmenu, UINT key )
 {
     POPUPMENU *menu;
     MENUITEM *item;
@@ -704,7 +704,7 @@
  *
  * Paint a popup menu.
  */
-static void MENU_DrawPopupMenu( HWND hwnd, HDC hdc, HMENU hmenu )
+static void MENU_DrawPopupMenu( HWND hwnd, HDC hdc, HMENU16 hmenu )
 {
     POPUPMENU *menu;
     MENUITEM *item;
@@ -731,7 +731,7 @@
     int i;
     WND *wndPtr = WIN_FindWndPtr( hwnd );
     
-    lppop = (LPPOPUPMENU) USER_HEAP_LIN_ADDR( (HMENU)wndPtr->wIDmenu );
+    lppop = (LPPOPUPMENU) USER_HEAP_LIN_ADDR( (HMENU16)wndPtr->wIDmenu );
     if (lppop == NULL || lprect == NULL) return SYSMETRICS_CYMENU;
     dprintf_menu(stddeb,"MENU_DrawMenuBar(%04x, %p, %p); !\n", 
 		 hDC, lprect, lppop);
@@ -756,7 +756,7 @@
 /***********************************************************************
  *	     MENU_SwitchTPWndTo
  */
-BOOL32 MENU_SwitchTPWndTo( HTASK hTask)
+BOOL32 MENU_SwitchTPWndTo( HTASK16 hTask )
 {
   /* This is supposed to be called when popup is hidden. 
    * AppExit() calls with hTask == 0, so we get the next to current.
@@ -789,7 +789,7 @@
  *
  * Display a popup menu.
  */
-static BOOL MENU_ShowPopup(HWND hwndOwner, HMENU hmenu, UINT id, int x, int y, 
+static BOOL MENU_ShowPopup(HWND hwndOwner, HMENU16 hmenu, UINT id, int x, int y, 
 						        int xanchor, int yanchor)
 {
     POPUPMENU 	*menu;
@@ -885,7 +885,7 @@
 /***********************************************************************
  *           MENU_SelectItem
  */
-static void MENU_SelectItem( HWND hwndOwner, HMENU hmenu, UINT wIndex,
+static void MENU_SelectItem( HWND hwndOwner, HMENU16 hmenu, UINT wIndex,
                              BOOL sendMenuSelect )
 {
     LPPOPUPMENU lppop;
@@ -949,7 +949,7 @@
  *           MENU_SelectItemRel
  *
  */
-static void MENU_SelectItemRel( HWND hwndOwner, HMENU hmenu, int offset )
+static void MENU_SelectItemRel( HWND hwndOwner, HMENU16 hmenu, int offset )
 {
     int i, min = 0;
     POPUPMENU *menu;
@@ -1038,7 +1038,7 @@
  *
  * Insert a new item into a menu.
  */
-static MENUITEM *MENU_InsertItem( HMENU hMenu, UINT pos, UINT flags )
+static MENUITEM *MENU_InsertItem( HMENU16 hMenu, UINT pos, UINT flags )
 {
     MENUITEM *newItems;
     POPUPMENU *menu;
@@ -1104,7 +1104,7 @@
  * Parse a standard menu resource and add items to the menu.
  * Return a pointer to the end of the resource.
  */
-static LPCSTR MENU_ParseResource( LPCSTR res, HMENU hMenu, BOOL unicode )
+static LPCSTR MENU_ParseResource( LPCSTR res, HMENU16 hMenu, BOOL unicode )
 {
     WORD flags, id = 0;
     LPCSTR str;
@@ -1126,7 +1126,7 @@
         else res += (lstrlen32W((LPCWSTR)str) + 1) * sizeof(WCHAR);
         if (flags & MF_POPUP)
         {
-            HMENU hSubMenu = CreatePopupMenu();
+            HMENU16 hSubMenu = CreatePopupMenu();
             if (!hSubMenu) return NULL;
             if (!(res = MENU_ParseResource( res, hSubMenu, unicode )))
                 return NULL;
@@ -1149,7 +1149,7 @@
  *
  * Return the handle of the selected sub-popup menu (if any).
  */
-static HMENU MENU_GetSubPopup( HMENU hmenu )
+static HMENU16 MENU_GetSubPopup( HMENU16 hmenu )
 {
     POPUPMENU *menu;
     MENUITEM *item;
@@ -1162,7 +1162,7 @@
     item = &menu->items[menu->FocusedItem];
     if (!(item->item_flags & MF_POPUP) || !(item->item_flags & MF_MOUSESELECT))
 	return 0;
-    return (HMENU)item->item_id;
+    return (HMENU16)item->item_id;
 }
 
 
@@ -1171,12 +1171,12 @@
  *
  * Hide the sub-popup menus of this menu.
  */
-static void MENU_HideSubPopups( HWND hwndOwner, HMENU hmenu,
+static void MENU_HideSubPopups( HWND hwndOwner, HMENU16 hmenu,
                                 BOOL sendMenuSelect )
 {
     MENUITEM *item;
     POPUPMENU *menu, *submenu;
-    HMENU hsubmenu;
+    HMENU16 hsubmenu;
 
     if (!(menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( hmenu ))) return;
     if (menu->FocusedItem == NO_SELECTED_ITEM) return;
@@ -1190,7 +1190,7 @@
 	if (!(item->item_flags & MF_POPUP) ||
 	    !(item->item_flags & MF_MOUSESELECT)) return;
 	item->item_flags &= ~MF_MOUSESELECT;
-	hsubmenu = (HMENU)item->item_id;
+	hsubmenu = (HMENU16)item->item_id;
     }
     submenu = (POPUPMENU *) USER_HEAP_LIN_ADDR( hsubmenu );
     MENU_HideSubPopups( hwndOwner, hsubmenu, FALSE );
@@ -1214,7 +1214,8 @@
  * Display the sub-menu of the selected item of this menu.
  * Return the handle of the submenu, or hmenu if no submenu to display.
  */
-static HMENU MENU_ShowSubPopup( HWND hwndOwner, HMENU hmenu, BOOL selectFirst )
+static HMENU16 MENU_ShowSubPopup( HWND hwndOwner, HMENU16 hmenu,
+                                  BOOL selectFirst )
 {
     POPUPMENU *menu;
     MENUITEM *item;
@@ -1239,7 +1240,7 @@
     item->item_flags |= MF_MOUSESELECT;
     if (menu->wFlags & MF_POPUP)
     {
-	MENU_ShowPopup( hwndOwner, (HMENU)item->item_id, menu->FocusedItem,
+	MENU_ShowPopup( hwndOwner, (HMENU16)item->item_id, menu->FocusedItem,
 		 wndPtr->rectWindow.left + item->rect.right-arrow_bitmap_width,
 		 wndPtr->rectWindow.top + item->rect.top,
 		 item->rect.left - item->rect.right + 2*arrow_bitmap_width, 
@@ -1247,13 +1248,13 @@
     }
     else
     {
-	MENU_ShowPopup( hwndOwner, (HMENU)item->item_id, menu->FocusedItem,
+	MENU_ShowPopup( hwndOwner, (HMENU16)item->item_id, menu->FocusedItem,
 		        wndPtr->rectWindow.left + item->rect.left,
 		        wndPtr->rectWindow.top + item->rect.bottom,
 			item->rect.right - item->rect.left, item->rect.bottom - item->rect.top );
     }
-    if (selectFirst) MENU_SelectItemRel( hwndOwner, (HMENU)item->item_id, ITEM_NEXT );
-    return (HMENU)item->item_id;
+    if (selectFirst) MENU_SelectItemRel( hwndOwner, (HMENU16)item->item_id, ITEM_NEXT );
+    return (HMENU16)item->item_id;
 }
 
 
@@ -1262,7 +1263,7 @@
  *
  * Find the menu containing a given point (in screen coords).
  */
-static HMENU MENU_FindMenuByCoords( HMENU hmenu, POINT16 pt )
+static HMENU16 MENU_FindMenuByCoords( HMENU16 hmenu, POINT16 pt )
 {
     POPUPMENU *menu;
     HWND hwnd;
@@ -1300,8 +1301,8 @@
  * Execute a menu item (for instance when user pressed Enter).
  * Return TRUE if we can go on with menu tracking.
  */
-static BOOL MENU_ExecFocusedItem( HWND hwndOwner, HMENU hmenu,
-				  HMENU *hmenuCurrent )
+static BOOL MENU_ExecFocusedItem( HWND hwndOwner, HMENU16 hmenu,
+				  HMENU16 *hmenuCurrent )
 {
     MENUITEM *item;
     POPUPMENU *menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( hmenu );
@@ -1333,8 +1334,8 @@
  * hmenuCurrent is the top-most visible popup.
  * Return TRUE if we can go on with menu tracking.
  */
-static BOOL MENU_ButtonDown( HWND hwndOwner, HMENU hmenu, HMENU *hmenuCurrent,
-			     POINT16 pt )
+static BOOL MENU_ButtonDown( HWND hwndOwner, HMENU16 hmenu,
+                             HMENU16 *hmenuCurrent, POINT16 pt )
 {
     POPUPMENU *menu;
     MENUITEM *item;
@@ -1383,12 +1384,12 @@
  * hmenuCurrent is the top-most visible popup.
  * Return TRUE if we can go on with menu tracking.
  */
-static BOOL MENU_ButtonUp( HWND hwndOwner, HMENU hmenu, HMENU *hmenuCurrent,
-			   POINT16 pt )
+static BOOL MENU_ButtonUp( HWND hwndOwner, HMENU16 hmenu,
+                           HMENU16 *hmenuCurrent, POINT16 pt )
 {
     POPUPMENU *menu;
     MENUITEM *item;
-    HMENU hsubmenu = 0;
+    HMENU16 hsubmenu = 0;
     UINT id;
 
     if (!hmenu) return FALSE;  /* Outside all menus */
@@ -1409,7 +1410,7 @@
 	{
 	    return MENU_ExecFocusedItem( hwndOwner, hmenu, hmenuCurrent );
 	}
-	hsubmenu = (HMENU)item->item_id;
+	hsubmenu = (HMENU16)item->item_id;
     }
       /* Select first item of sub-popup */
     MENU_SelectItem( hwndOwner, hsubmenu, NO_SELECTED_ITEM, FALSE );
@@ -1425,8 +1426,8 @@
  * hmenuCurrent is the top-most visible popup.
  * Return TRUE if we can go on with menu tracking.
  */
-static BOOL MENU_MouseMove( HWND hwndOwner, HMENU hmenu, HMENU *hmenuCurrent,
-			    POINT16 pt )
+static BOOL MENU_MouseMove( HWND hwndOwner, HMENU16 hmenu,
+                            HMENU16 *hmenuCurrent, POINT16 pt )
 {
     MENUITEM *item;
     POPUPMENU *menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( hmenu );
@@ -1458,7 +1459,8 @@
 /***********************************************************************
  *           MENU_DoNextMenu
  */
-static LRESULT MENU_DoNextMenu( HWND* hwndOwner, HMENU* hmenu, HMENU *hmenuCurrent, UINT vk)
+static LRESULT MENU_DoNextMenu( HWND* hwndOwner, HMENU16* hmenu,
+                                HMENU16 *hmenuCurrent, UINT vk)
 {
   POPUPMENU *menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( *hmenu );
   UINT	     id = 0;
@@ -1541,10 +1543,11 @@
  * Handle a VK_LEFT key event in a menu.
  * hmenuCurrent is the top-most visible popup.
  */
-static void MENU_KeyLeft( HWND* hwndOwner, HMENU* hmenu, HMENU *hmenuCurrent )
+static void MENU_KeyLeft( HWND* hwndOwner, HMENU16* hmenu,
+                          HMENU16 *hmenuCurrent )
 {
     POPUPMENU *menu;
-    HMENU hmenutmp, hmenuprev;
+    HMENU16 hmenutmp, hmenuprev;
 
     menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( *hmenu );
     hmenuprev = hmenutmp = *hmenu;
@@ -1581,10 +1584,11 @@
  * Handle a VK_RIGHT key event in a menu.
  * hmenuCurrent is the top-most visible popup.
  */
-static void MENU_KeyRight( HWND* hwndOwner, HMENU* hmenu, HMENU *hmenuCurrent )
+static void MENU_KeyRight( HWND* hwndOwner, HMENU16* hmenu,
+                           HMENU16 *hmenuCurrent )
 {
     POPUPMENU *menu;
-    HMENU hmenutmp;
+    HMENU16 hmenutmp;
 
     menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( *hmenu );
 
@@ -1620,7 +1624,7 @@
     }
     else if (*hmenuCurrent != *hmenu)  /* Hide last level popup */
     {
-	HMENU hmenuprev;
+	HMENU16 hmenuprev;
 	hmenuprev = hmenutmp = *hmenu;
 	while (hmenutmp != *hmenuCurrent)
 	{
@@ -1640,12 +1644,12 @@
  * If 'x' and 'y' are not 0, we simulate a button-down event at (x,y)
  * before beginning tracking. This is to help menu-bar tracking.
  */
-static BOOL MENU_TrackMenu( HMENU hmenu, UINT wFlags, int x, int y,
+static BOOL MENU_TrackMenu( HMENU16 hmenu, UINT wFlags, int x, int y,
 			    HWND hwnd, const RECT16 *lprect )
 {
     MSG16 msg;
     POPUPMENU *menu;
-    HMENU hmenuCurrent = hmenu;
+    HMENU16 hmenuCurrent = hmenu;
     BOOL fClosed = FALSE, fRemove;
     UINT pos;
 
@@ -1668,7 +1672,7 @@
 	if ((msg.message >= WM_MOUSEFIRST) && (msg.message <= WM_MOUSELAST))
 	{
 	      /* Find the sub-popup for this mouse event (if any) */
-	    HMENU hsubmenu = MENU_FindMenuByCoords( hmenu, msg.pt );
+	    HMENU16 hsubmenu = MENU_FindMenuByCoords( hmenu, msg.pt );
 
 	    switch(msg.message)
 	    {
@@ -1822,7 +1826,7 @@
     HideCaret(0);
     SendMessage16( hwnd, WM_ENTERMENULOOP, 0, 0 );
     SendMessage16( hwnd, WM_INITMENU, wndPtr->wIDmenu, 0 );
-    MENU_TrackMenu( (HMENU)wndPtr->wIDmenu, TPM_LEFTALIGN | TPM_LEFTBUTTON,
+    MENU_TrackMenu( (HMENU16)wndPtr->wIDmenu, TPM_LEFTALIGN | TPM_LEFTBUTTON,
 		    pt.x, pt.y, hwnd, NULL );
     SendMessage16( hwnd, WM_EXITMENULOOP, 0, 0 );
     ShowCaret(0);
@@ -1837,7 +1841,7 @@
 void MENU_TrackKbdMenuBar( WND* wndPtr, UINT wParam, INT vkey)
 {
     UINT uItem = NO_SELECTED_ITEM;
-   HMENU hTrackMenu; 
+   HMENU16 hTrackMenu; 
 
     /* find window that has a menu 
      */
@@ -1945,7 +1949,7 @@
 	    PAINTSTRUCT16 ps;
 	    BeginPaint16( hwnd, &ps );
 	    MENU_DrawPopupMenu( hwnd, ps.hdc,
-                                (HMENU)GetWindowLong32A( hwnd, 0 ) );
+                                (HMENU16)GetWindowLong32A( hwnd, 0 ) );
 	    EndPaint16( hwnd, &ps );
 	    return 0;
 	}
@@ -1962,7 +1966,7 @@
 	    break;
 
     case WM_USER:
-	if (wParam) SetWindowLong32A( hwnd, 0, (HMENU)wParam );
+	if (wParam) SetWindowLong32A( hwnd, 0, (HMENU16)wParam );
         break;
     default:
 	return DefWindowProc16(hwnd, message, wParam, lParam);
@@ -1984,7 +1988,7 @@
     LPPOPUPMENU lppop;
 
     if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0;
-    if (!(lppop = (LPPOPUPMENU)USER_HEAP_LIN_ADDR((HMENU)wndPtr->wIDmenu)))
+    if (!(lppop = (LPPOPUPMENU)USER_HEAP_LIN_ADDR((HMENU16)wndPtr->wIDmenu)))
       return 0;
     hdc = GetDCEx32( hwnd, 0, DCX_CACHE | DCX_WINDOW );
     SetRect16(&rectBar, orgX, orgY, orgX+menubarWidth, orgY+SYSMETRICS_CYMENU);
@@ -2063,7 +2067,7 @@
 /*******************************************************************
  *         CheckMenuItem    (USER.154)
  */
-INT CheckMenuItem( HMENU hMenu, UINT id, UINT flags )
+INT CheckMenuItem( HMENU16 hMenu, UINT id, UINT flags )
 {
     MENUITEM *item;
     INT ret;
@@ -2080,7 +2084,7 @@
 /**********************************************************************
  *			EnableMenuItem		[USER.155]
  */
-BOOL EnableMenuItem(HMENU hMenu, UINT wItemID, UINT wFlags)
+BOOL EnableMenuItem(HMENU16 hMenu, UINT wItemID, UINT wFlags)
 {
     MENUITEM *item;
     dprintf_menu(stddeb,"EnableMenuItem (%04x, %04X, %04X) !\n", 
@@ -2107,7 +2111,7 @@
 /*******************************************************************
  *         GetMenuString    (USER.161)
  */
-int GetMenuString( HMENU hMenu, UINT wItemID,
+int GetMenuString( HMENU16 hMenu, UINT wItemID,
                    LPSTR str, short nMaxSiz, UINT wFlags )
 {
     MENUITEM *item;
@@ -2127,7 +2131,7 @@
 /**********************************************************************
  *			HiliteMenuItem		[USER.162]
  */
-BOOL HiliteMenuItem(HWND hWnd, HMENU hMenu, UINT wItemID, UINT wHilite)
+BOOL HiliteMenuItem(HWND hWnd, HMENU16 hMenu, UINT wItemID, UINT wHilite)
 {
     LPPOPUPMENU menu;
     dprintf_menu(stddeb,"HiliteMenuItem(%04x, %04x, %04x, %04x);\n", 
@@ -2144,7 +2148,7 @@
 /**********************************************************************
  *			GetMenuState		[USER.250]
  */
-UINT GetMenuState(HMENU hMenu, UINT wItemID, UINT wFlags)
+UINT GetMenuState(HMENU16 hMenu, UINT wItemID, UINT wFlags)
 {
     MENUITEM *item;
     dprintf_menu(stddeb,"GetMenuState(%04x, %04x, %04x);\n", 
@@ -2152,7 +2156,7 @@
     if (!(item = MENU_FindItem( &hMenu, &wItemID, wFlags ))) return -1;
     if (item->item_flags & MF_POPUP)
     {
-	POPUPMENU *menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( (HMENU)item->item_id );
+	POPUPMENU *menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( (HMENU16)item->item_id );
 	if (!menu) return -1;
 	else return (menu->nItems << 8) | (menu->wFlags & 0xff);
     }
@@ -2163,7 +2167,7 @@
 /**********************************************************************
  *			GetMenuItemCount		[USER.263]
  */
-INT GetMenuItemCount(HMENU hMenu)
+INT GetMenuItemCount(HMENU16 hMenu)
 {
 	LPPOPUPMENU	menu;
 	dprintf_menu(stddeb,"GetMenuItemCount(%04x);\n", hMenu);
@@ -2178,7 +2182,7 @@
 /**********************************************************************
  *			GetMenuItemID			[USER.264]
  */
-UINT GetMenuItemID(HMENU hMenu, int nPos)
+UINT GetMenuItemID(HMENU16 hMenu, int nPos)
 {
     LPPOPUPMENU	menu;
 
@@ -2226,7 +2230,7 @@
     }
 
     if (flags & MF_POPUP)  /* Set the MF_POPUP flag on the popup-menu */
-	((POPUPMENU *)USER_HEAP_LIN_ADDR((HMENU)id))->wFlags |= MF_POPUP;
+	((POPUPMENU *)USER_HEAP_LIN_ADDR((HMENU16)id))->wFlags |= MF_POPUP;
 
     item->hCheckBit   = hStdCheck;
     item->hUnCheckBit = 0;
@@ -2283,7 +2287,7 @@
 /**********************************************************************
  *			RemoveMenu		[USER.412]
  */
-BOOL RemoveMenu(HMENU hMenu, UINT nPos, UINT wFlags)
+BOOL RemoveMenu(HMENU16 hMenu, UINT nPos, UINT wFlags)
 {
     LPPOPUPMENU	menu;
     MENUITEM *item;
@@ -2319,11 +2323,11 @@
 /**********************************************************************
  *			DeleteMenu		[USER.413]
  */
-BOOL DeleteMenu(HMENU hMenu, UINT nPos, UINT wFlags)
+BOOL DeleteMenu(HMENU16 hMenu, UINT nPos, UINT wFlags)
 {
     MENUITEM *item = MENU_FindItem( &hMenu, &nPos, wFlags );
     if (!item) return FALSE;
-    if (item->item_flags & MF_POPUP) DestroyMenu( (HMENU)item->item_id );
+    if (item->item_flags & MF_POPUP) DestroyMenu( (HMENU16)item->item_id );
       /* nPos is now the position of the item */
     RemoveMenu( hMenu, nPos, wFlags | MF_BYPOSITION );
     return TRUE;
@@ -2350,7 +2354,7 @@
                       UINT32 id, LPCSTR str )
 {
     MENUITEM *item;
-    HMENU hMenu16 = hMenu;
+    HMENU16 hMenu16 = hMenu;
     UINT16 pos16 = pos;
 
     if (IS_STRING_ITEM(flags))
@@ -2392,9 +2396,9 @@
 /**********************************************************************
  *			CreatePopupMenu		[USER.415]
  */
-HMENU CreatePopupMenu()
+HMENU16 CreatePopupMenu()
 {
-    HMENU hmenu;
+    HMENU16 hmenu;
     POPUPMENU *menu;
 
     if (!(hmenu = CreateMenu())) return 0;
@@ -2416,8 +2420,8 @@
 /**********************************************************************
  *			SetMenuItemBitmaps	[USER.418]
  */
-BOOL SetMenuItemBitmaps(HMENU hMenu, UINT nPos, UINT wFlags,
-                        HBITMAP hNewUnCheck, HBITMAP hNewCheck)
+BOOL SetMenuItemBitmaps(HMENU16 hMenu, UINT nPos, UINT wFlags,
+                        HBITMAP16 hNewUnCheck, HBITMAP16 hNewCheck)
 {
     MENUITEM *item;
     dprintf_menu(stddeb,"SetMenuItemBitmaps(%04x, %04x, %04x, %04x, %04x)\n",
@@ -2444,9 +2448,9 @@
 /**********************************************************************
  *			CreateMenu		[USER.151]
  */
-HMENU CreateMenu()
+HMENU16 CreateMenu()
 {
-    HMENU hMenu;
+    HMENU16 hMenu;
     LPPOPUPMENU menu;
     dprintf_menu(stddeb,"CreateMenu !\n");
     if (!(hMenu = USER_HEAP_ALLOC( sizeof(POPUPMENU) )))
@@ -2469,7 +2473,7 @@
 /**********************************************************************
  *			DestroyMenu		[USER.152]
  */
-BOOL DestroyMenu(HMENU hMenu)
+BOOL DestroyMenu(HMENU16 hMenu)
 {
     LPPOPUPMENU lppop;
     dprintf_menu(stddeb,"DestroyMenu (%04x) !\n", hMenu);
@@ -2490,7 +2494,7 @@
         for (i = lppop->nItems; i > 0; i--, item++)
         {
             if (item->item_flags & MF_POPUP)
-                DestroyMenu( (HMENU)item->item_id );
+                DestroyMenu( (HMENU16)item->item_id );
 	    if (IS_STRING_ITEM(item->item_flags) && item->text)
                 HeapFree( SystemHeap, 0, item->text );
         }
@@ -2504,7 +2508,7 @@
 /**********************************************************************
  *			GetSystemMenu		[USER.156]
  */
-HMENU GetSystemMenu(HWND hWnd, BOOL bRevert)
+HMENU16 GetSystemMenu(HWND hWnd, BOOL bRevert)
 {
     WND *wndPtr = WIN_FindWndPtr( hWnd );
     if (!wndPtr) return 0;
@@ -2524,7 +2528,7 @@
 /*******************************************************************
  *         SetSystemMenu    (USER.280)
  */
-BOOL SetSystemMenu( HWND hwnd, HMENU hMenu )
+BOOL SetSystemMenu( HWND hwnd, HMENU16 hMenu )
 {
     WND *wndPtr;
 
@@ -2539,18 +2543,18 @@
 /**********************************************************************
  *			GetMenu		[USER.157]
  */
-HMENU GetMenu(HWND hWnd) 
+HMENU16 GetMenu(HWND hWnd) 
 { 
 	WND * wndPtr = WIN_FindWndPtr(hWnd);
 	if (wndPtr == NULL) return 0;
-	return (HMENU)wndPtr->wIDmenu;
+	return (HMENU16)wndPtr->wIDmenu;
 }
 
 
 /**********************************************************************
  * 			SetMenu 	[USER.158]
  */
-BOOL SetMenu(HWND hWnd, HMENU hMenu)
+BOOL SetMenu(HWND hWnd, HMENU16 hMenu)
 {
 	LPPOPUPMENU lpmenu;
 	WND * wndPtr = WIN_FindWndPtr(hWnd);
@@ -2585,7 +2589,7 @@
 /**********************************************************************
  *			GetSubMenu		[USER.159]
  */
-HMENU GetSubMenu(HMENU hMenu, short nPos)
+HMENU16 GetSubMenu(HMENU16 hMenu, short nPos)
 {
     LPPOPUPMENU lppop;
 
@@ -2593,7 +2597,7 @@
     if (!(lppop = (LPPOPUPMENU) USER_HEAP_LIN_ADDR(hMenu))) return 0;
     if ((UINT)nPos >= lppop->nItems) return 0;
     if (!(lppop->items[nPos].item_flags & MF_POPUP)) return 0;
-    return (HMENU)lppop->items[nPos].item_id;
+    return (HMENU16)lppop->items[nPos].item_id;
 }
 
 
@@ -2610,7 +2614,7 @@
 		wndPtr->wIDmenu != 0) {
 		dprintf_menu(stddeb,"DrawMenuBar wIDmenu=%04X \n", 
 			     wndPtr->wIDmenu);
-		lppop = (LPPOPUPMENU) USER_HEAP_LIN_ADDR((HMENU)wndPtr->wIDmenu);
+		lppop = (LPPOPUPMENU) USER_HEAP_LIN_ADDR((HMENU16)wndPtr->wIDmenu);
 		if (lppop == NULL) return;
 
 		lppop->Height = 0; /* Make sure we call MENU_MenuBarCalcSize */
@@ -2633,7 +2637,7 @@
 /***********************************************************************
  *           LookupMenuHandle   (USER.217)
  */
-HMENU LookupMenuHandle( HMENU hmenu, INT id )
+HMENU16 LookupMenuHandle( HMENU16 hmenu, INT id )
 {
     if (!MENU_FindItem( &hmenu, &id, MF_BYCOMMAND )) return 0;
     else return hmenu;
@@ -2700,7 +2704,7 @@
  */
 HMENU16 LoadMenuIndirect16( LPCVOID template )
 {
-    HMENU hMenu;
+    HMENU16 hMenu;
     WORD version, offset;
     LPCSTR p = (LPCSTR)template;
 
@@ -2729,7 +2733,7 @@
  */
 HMENU32 LoadMenuIndirect32A( LPCVOID template )
 {
-    HMENU hMenu;
+    HMENU16 hMenu;
     WORD version, offset;
     LPCSTR p = (LPCSTR)template;
 
@@ -2767,7 +2771,7 @@
 /**********************************************************************
  *		IsMenu    (USER.358)
  */
-BOOL IsMenu( HMENU hmenu )
+BOOL IsMenu( HMENU16 hmenu )
 {
     LPPOPUPMENU menu;
     if (!(menu = (LPPOPUPMENU) USER_HEAP_LIN_ADDR( hmenu ))) return FALSE;
diff --git a/controls/scroll.c b/controls/scroll.c
index 34497fc..1364fc1 100644
--- a/controls/scroll.c
+++ b/controls/scroll.c
@@ -1249,7 +1249,7 @@
         else  /* hide it */
         {
             if (!(wndPtr->dwStyle & WS_HSCROLL)
-                && !(wndPtr->dwStyle & WS_HSCROLL)) return TRUE;
+                && !(wndPtr->dwStyle & WS_VSCROLL)) return TRUE;
             wndPtr->dwStyle &= ~(WS_HSCROLL | WS_VSCROLL);
         }
         break;
diff --git a/controls/static.c b/controls/static.c
index 8f91c6f..88bf0b2 100644
--- a/controls/static.c
+++ b/controls/static.c
@@ -145,7 +145,7 @@
 
         case WM_SETFONT:
             if (style == SS_ICON) return 0;
-            infoPtr->hFont = (HFONT)wParam;
+            infoPtr->hFont = (HFONT16)wParam;
             if (LOWORD(lParam))
             {
                 InvalidateRect32( hWnd, NULL, FALSE );
@@ -183,7 +183,7 @@
 static void STATIC_PaintTextfn( WND *wndPtr, HDC hdc )
 {
     RECT16 rc;
-    HBRUSH hBrush;
+    HBRUSH16 hBrush;
     WORD wFormat;
 
     LONG style = wndPtr->dwStyle;
@@ -231,7 +231,7 @@
 static void STATIC_PaintRectfn( WND *wndPtr, HDC hdc )
 {
     RECT16 rc;
-    HBRUSH hBrush;
+    HBRUSH16 hBrush;
 
     GetClientRect16( wndPtr->hwndSelf, &rc);
     
@@ -271,7 +271,7 @@
 static void STATIC_PaintIconfn( WND *wndPtr, HDC hdc )
 {
     RECT16 rc;
-    HBRUSH      hbrush;
+    HBRUSH16 hbrush;
     STATICINFO *infoPtr = (STATICINFO *)wndPtr->wExtra;
 
     GetClientRect16( wndPtr->hwndSelf, &rc);