Index: trunk/src/comctl32/CCBase.h
===================================================================
--- trunk/src/comctl32/CCBase.h	(revision 5413)
+++ trunk/src/comctl32/CCBase.h	(revision 5416)
@@ -1,3 +1,3 @@
-/* $Id: CCBase.h,v 1.11 2000-11-19 11:51:47 sandervl Exp $ */
+/* $Id: CCBase.h,v 1.12 2001-03-31 13:25:25 sandervl Exp $ */
 /*
  * COMCTL32 Base Functions and Macros for all Controls
@@ -7,4 +7,6 @@
 #ifndef __CCBASE_H
 #define __CCBASE_H
+
+#include <heapstring.h>
 
 #define getInfoPtr(hwnd) ((COMCTL32_HEADER*)GetWindowLongA(hwnd,0))
@@ -20,11 +22,10 @@
 } COMCTL32_HEADER;
 
-PVOID initControl(HWND hwnd,DWORD dwSize);
-VOID doneControl(HWND hwnd);
-
-
 #ifdef __cplusplus
 extern "C" {
 #endif
+
+PVOID initControl(HWND hwnd,DWORD dwSize);
+VOID doneControl(HWND hwnd);
 
 LRESULT defComCtl32ProcA(HWND hwnd,UINT Msg,WPARAM wParam,LPARAM lParam);
@@ -65,8 +66,9 @@
 INT lstrcmpAW(WCHAR *textA,BOOL textaunicode,WCHAR *textB,BOOL textbunicode);
 
+
 //read note in CCBase.cpp!!
 INT lstrcmpniA(CHAR *textA,CHAR *textB,INT len);
 INT lstrcmpniAtoW(CHAR *textA,WCHAR* textB,INT len);
-INT lstrcmpniW(WCHAR *textA,WCHAR *textB,INT len);
+////INT lstrcmpniW(WCHAR *textA,WCHAR *textB,INT len);
 INT lstrcmpniAW(WCHAR *textA,BOOL unicodeA,WCHAR *textB,BOOL unicodeB,INT len);
 
Index: trunk/src/comctl32/animate.c
===================================================================
--- trunk/src/comctl32/animate.c	(revision 5413)
+++ trunk/src/comctl32/animate.c	(revision 5416)
@@ -30,4 +30,8 @@
 typedef struct
 {
+#ifdef __WIN32OS2__
+    COMCTL32_HEADER header;
+#endif
+
    /* pointer to msvideo functions. it's easier to put them here.
     * to be correct, they should be defined on a per process basis, but
@@ -819,5 +823,9 @@
 
     /* allocate memory for info structure */
+#ifdef __WIN32OS2__
+    infoPtr = (ANIMATE_INFO*)initControl(hWnd,sizeof(ANIMATE_INFO));
+#else
     infoPtr = (ANIMATE_INFO *)COMCTL32_Alloc(sizeof(ANIMATE_INFO));
+#endif
     if (!infoPtr) {
         ERR("could not allocate info memory!\n");
Index: trunk/src/comctl32/comboex.c
===================================================================
--- trunk/src/comctl32/comboex.c	(revision 5413)
+++ trunk/src/comctl32/comboex.c	(revision 5416)
@@ -1,4 +1,23 @@
 /*
- * ComboBoxEx control
+ * TODO   <-------------
+ *  1. The following extended styles need to be implemented, use will
+ *     result in a FIXME:
+ *           CBES_EX_NOEDITIMAGEINDENT
+ *	     CBES_EX_PATHWORDBREAKPROC
+ *	     CBES_EX_NOSIZELIMIT
+ *	     CBES_EX_CASESENSITIVE
+ *  2. None of the following callback items are implemented. Therefor
+ *     no CBEN_GETDISPINFO notifies are issued. Use in either CBEM_INSERTITEM
+ *     or CBEM_SETITEM will result in a FIXME:
+ *           LPSTR_TEXTCALLBACK
+ *           I_IMAGECALLBACK
+ *           I_INDENTCALLBACK
+ *  3. No use is made of the iOverlay image.
+ *  4. Notify CBEN_DRAGBEGIN is not implemented.
+ */
+
+
+/*
+ * ComboBoxEx control v2 (mod4)
  *
  * Copyright 1998, 1999 Eric Kohl
@@ -9,43 +28,56 @@
  *     Eric <ekohl@abo.rhein-zeitung.de>
  *
- * TODO:
- *   - All messages.
- *   - All notifications.
+
+ * Changes  Guy Albertelli <galberte@neo.lrun.com>
+ * v1  Implemented messages: CB_SETITEMHEIGHT, WM_WINDOWPOSCHANGING,
+ *      WM_DRAWITEM, and WM_MEASUREITEM. Fixed WM_CREATE. Fixed height
+ *      of window rect reported fixing rebar control.
+ * v2
+ *   1. Rewrite of WM_Create for own created EDIT control. Also try to
+ *      generate message sequence similar to native DLL.
+ *   2. Handle case where CBEM_SETITEM is called to display data in EDIT
+ *      Control. 
+ *   3. Add override for WNDPROC for the EDIT control (reqed for VK_RETURN).
+ *   4. Dump input data for things using COMBOBOXEXITEM{A|W}.
+ *   5. Handle positioning EDIT control based on whether icon present.
+ *   6. Make InsertItemA use InsertItemW, and store all data in ..W form.
+ *   7. Implement CBEM_DELETEITEM, CBEM_GETITEM{A|W}, CB_SETCURSEL,
+ *      CBEM_{GET|SET}UNICODEFORMAT.
+ *   8. Add override for WNDPROC for the COMBO control.
+ *   9. Support extended style CBES_EX_NOEDITIMAGE and warn others are not
+ *      supported.
+ *  10. Implement CB_FINDSTRINGEXACT in both the Combo and ComboEx window
+ *      procs to match the items. This eliminates dup entries in the listbox.
  *
- * FIXME:
- *   - should include "combo.h"
-
- * Changes  Guy Albertelli <galberte@neo.lrun.com>
- *   1. Implemented message CB_SETITEMHEIGHT
- *   2. Implemented message WM_WINDOWPOSCHANGING
- *   3. Implemented message WM_MEASUREITEM
- *   4. Add code to WM_CREATE processing to set font of COMBOBOX and
- *      issue the CB_SETITEMHEIGHT to start the correct sizing process.
- * The above 4 changes allow the window rect for the comboboxex
- * to be set properly, which in turn allows the height of the
- * rebar control it *may* be imbeded in to be correct.
- *   5. Rewrite CBEM_INSERTITEMA to save the information.
- *   6. Implemented message WM_DRAWITEM. The code will handle images
- *      but not "overlays" yet.
- *   7. Fixed code in CBEM_SETIMAGELIST to resize control.
- *   8. Add debugging code.
+ *  mod 4
+ *   1. Implemented CBN_SELCHANGE, CBN_KILLFOCUS, and CBN_SELENDOK.
+ *   2. Fix putting text in CBEN_ENDEDIT notifys for CBN_DROPDOWN case.
+ *   3. Lock image selected status to focus state of edit control if
+ *      edit control exists. Mimics native actions.
+ *   4. Implemented WM_SETFOCUS in EditWndProc to track status of 
+ *      focus for 3 above.
+ *   5. The LBN_SELCHANGE is just for documentation purposes.
  *
- * Test vehicals were the ControlSpy modules (rebar.exe and comboboxex.exe)
+ * Test vehicals were the ControlSpy modules (rebar.exe and comboboxex.exe),
+ *  and IE 4.0.
  *
  */
 
-#ifdef __WIN32OS2__
-#include <odin.h>
 #include <string.h>
-#define inline
-#endif
-
 #include "winbase.h"
-#include "wine/winestring.h"
 #include "commctrl.h"
 #include "debugtools.h"
 #include "wine/unicode.h"
 
+#ifdef __WIN32OS2__
+#include "ccbase.h"
+#define inline
+#endif
+
 DEFAULT_DEBUG_CHANNEL(comboex);
+/*
+ * The following is necessary for the test done in COMBOEX_DrawItem
+ * to determine whether to dump out the DRAWITEM structure or not.
+ */
 DECLARE_DEBUG_CHANNEL(message);
 
@@ -53,13 +85,13 @@
 typedef struct
 {
-    VOID *next;
-    UINT mask;
-    LPWSTR pszText;
-    int cchTextMax;
-    int iImage;
-    int iSelectedImage;
-    int iOverlay;
-    int iIndent;
-    LPARAM lParam;
+    VOID         *next;
+    UINT         mask;
+    LPWSTR       pszText;
+    int          cchTextMax;
+    int          iImage;
+    int          iSelectedImage;
+    int          iOverlay;
+    int          iIndent;
+    LPARAM       lParam;
 } CBE_ITEMDATA;
 
@@ -67,13 +99,47 @@
 typedef struct
 {
+#ifdef __WIN32OS2__
+    COMCTL32_HEADER header;
+#endif
     HIMAGELIST   himl;
+    HWND         hwndSelf;         /* my own hwnd */
     HWND         hwndCombo;
+    HWND         hwndEdit;
+    WNDPROC      prevEditWndProc;  /* previous Edit WNDPROC value */
+    WNDPROC      prevComboWndProc;   /* previous Combo WNDPROC value */
     DWORD        dwExtStyle;
+    DWORD        flags;            /* WINE internal flags */
     HFONT        font;
     INT          nb_items;         /* Number of items */
+    BOOL         bUnicode;         /* ASCII (FALSE) or Unicode (TRUE)? */
+    CBE_ITEMDATA *edit;            /* item data for edit item */
     CBE_ITEMDATA *items;           /* Array of items */
 } COMBOEX_INFO;
 
+/* internal flags in the COMBOEX_INFO structure */
+#define  WCBE_ACTEDIT        0x00000001     /* Edit active i.e.
+                                             * CBEN_BEGINEDIT issued
+                                             * but CBEN_ENDEDIT{A|W}
+                                             * not yet issued. */
+#define  WCBE_EDITCHG        0x00000002     /* Edit issued EN_CHANGE */
+#define  WCBE_EDITFOCUSED    0x00000004     /* Edit control has focus */
+
+
 #define ID_CB_EDIT    1001
+
+
+/*
+ * Special flag set in DRAWITEMSTRUCT itemState field. It is set by
+ * the ComboEx version of the Combo Window Proc so that when the 
+ * WM_DRAWITEM message is then passed to ComboEx, we know that this 
+ * particular WM_DRAWITEM message is for listbox only items. Any messasges
+ * without this flag is then for the Edit control field.
+ *
+ * We really cannot use the ODS_COMBOBOXEDIT flag because MSDN states that 
+ * only version 4.0 applications will have ODS_COMBOBOXEDIT set.
+ */
+#define ODS_COMBOEXLBOX  0x4000
+
+
 
 /* Height in pixels of control over the amount of the selected font */
@@ -89,6 +155,13 @@
 #define CBE_SEP   4
 
-#define COMBOEX_GetInfoPtr(wndPtr) ((COMBOEX_INFO *)GetWindowLongA (hwnd, 0))
-
+#define COMBOEX_GetInfoPtr(hwnd) ((COMBOEX_INFO *)GetWindowLongA (hwnd, 0))
+
+
+/* Things common to the entire DLL */
+static ATOM ComboExInfo;
+static LRESULT WINAPI
+COMBOEX_EditWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
+static LRESULT WINAPI
+COMBOEX_ComboWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
 
 static void
@@ -97,8 +170,32 @@
     if (TRACE_ON(comboex)){
       TRACE("item %p - mask=%08x, pszText=%p, cchTM=%d, iImage=%d\n",
-        item, item->mask, item->pszText, item->cchTextMax,
-        item->iImage);
+	    item, item->mask, item->pszText, item->cchTextMax,
+	    item->iImage);
       TRACE("item %p - iSelectedImage=%d, iOverlay=%d, iIndent=%d, lParam=%08lx\n",
-        item, item->iSelectedImage, item->iOverlay, item->iIndent, item->lParam);
+	    item, item->iSelectedImage, item->iOverlay, item->iIndent, item->lParam);
+      if ((item->mask & CBEIF_TEXT) && item->pszText)
+	  TRACE("item %p - pszText=%s\n",
+		item, debugstr_w((const WCHAR *)item->pszText));
+    }
+}
+
+
+static void
+COMBOEX_DumpInput (COMBOBOXEXITEMA *input, BOOL true_for_w)
+{
+    if (TRACE_ON(comboex)){
+      TRACE("input - mask=%08x, iItem=%d, pszText=%p, cchTM=%d, iImage=%d\n",
+	    input->mask, input->iItem, input->pszText, input->cchTextMax,
+	    input->iImage);
+      if ((input->mask & CBEIF_TEXT) && input->pszText) {
+	  if (true_for_w)
+	      TRACE("input - pszText=<%s>\n", 
+		    debugstr_w((const WCHAR *)input->pszText));
+	  else 
+	      TRACE("input - pszText=<%s>\n", 
+		    debugstr_a((const char *)input->pszText));
+      }
+      TRACE("input - iSelectedImage=%d, iOverlay=%d, iIndent=%d, lParam=%08lx\n",
+	    input->iSelectedImage, input->iOverlay, input->iIndent, input->lParam);
     }
 }
@@ -110,10 +207,97 @@
     COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
 
-    FIXME("(0x%x 0x%x 0x%lx): stub\n", uMsg, wParam, lParam);
-
-    if (infoPtr->hwndCombo)
-    return SendMessageA (infoPtr->hwndCombo, uMsg, wParam, lParam);
+    if (infoPtr->hwndCombo)    
+	return SendMessageA (infoPtr->hwndCombo, uMsg, wParam, lParam);
 
     return 0;
+}
+
+
+static INT
+COMBOEX_Notify (COMBOEX_INFO *infoPtr, INT code, NMHDR *hdr, BOOL doW)
+{
+
+    hdr->idFrom = GetDlgCtrlID (infoPtr->hwndSelf);
+    hdr->hwndFrom = infoPtr->hwndSelf;
+    hdr->code = code;
+    if (doW)
+	return SendMessageW (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0,
+			     (LPARAM)hdr);
+    else
+	return SendMessageA (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0,
+			     (LPARAM)hdr);
+}
+
+
+static void
+COMBOEX_GetComboFontSize (COMBOEX_INFO *infoPtr, SIZE *size)
+{
+    HFONT nfont, ofont;
+    HDC mydc;
+
+    mydc = GetDC (0); /* why the entire screen???? */
+    nfont = SendMessageW (infoPtr->hwndCombo, WM_GETFONT, 0, 0);
+    ofont = (HFONT) SelectObject (mydc, nfont);
+    GetTextExtentPointA (mydc, "A", 1, size);
+    SelectObject (mydc, ofont);
+    ReleaseDC (0, mydc);
+    TRACE("selected font hwnd=%08x, height=%ld\n", nfont, size->cy);
+}
+
+
+static void
+COMBOEX_CopyItem (COMBOEX_INFO *infoPtr, CBE_ITEMDATA *item, COMBOBOXEXITEMW *cit)
+{
+    if (cit->mask & CBEIF_TEXT) {
+        cit->pszText        = item->pszText;
+        cit->cchTextMax     = item->cchTextMax;
+    }
+    if (cit->mask & CBEIF_IMAGE)
+	cit->iImage         = item->iImage;
+    if (cit->mask & CBEIF_SELECTEDIMAGE)
+	cit->iSelectedImage = item->iSelectedImage;
+    if (cit->mask & CBEIF_OVERLAY)
+	cit->iOverlay       = item->iOverlay;
+    if (cit->mask & CBEIF_INDENT)
+	cit->iIndent        = item->iIndent;
+    if (cit->mask & CBEIF_LPARAM)
+	cit->lParam         = item->lParam;
+
+}
+
+
+static void
+COMBOEX_AdjustEditPos (COMBOEX_INFO *infoPtr)
+{
+    SIZE mysize;
+    IMAGEINFO iinfo;
+    INT x, y, w, h, xoff = 0;
+    RECT rect;
+
+    if (!infoPtr->hwndEdit) return;
+    iinfo.rcImage.left = iinfo.rcImage.right = 0;
+    if (infoPtr->himl) {
+	ImageList_GetImageInfo(infoPtr->himl, 0, &iinfo);
+	xoff = iinfo.rcImage.right - iinfo.rcImage.left + CBE_SEP;
+    }
+    GetClientRect (infoPtr->hwndCombo, &rect);
+    InflateRect (&rect, -2, -2);
+    InvalidateRect (infoPtr->hwndCombo, &rect, TRUE);
+
+    /* reposition the Edit control based on whether icon exists */
+    COMBOEX_GetComboFontSize (infoPtr, &mysize);
+    TRACE("Combo font x=%ld, y=%ld\n", mysize.cx, mysize.cy);
+    x = xoff + CBE_STARTOFFSET + 1;
+    y = CBE_EXTRA + 1;
+    w = rect.right-rect.left - x - GetSystemMetrics(SM_CXVSCROLL) - 1;
+    h = mysize.cy + 1;
+
+    TRACE("Combo client (%d,%d)-(%d,%d), setting Edit to (%d,%d)-(%d,%d)\n",
+	  rect.left, rect.top, rect.right, rect.bottom,
+	  x, y, x + w, y + h);
+    SetWindowPos(infoPtr->hwndEdit, HWND_TOP,
+		 x, y,
+		 w, h,
+		 SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOZORDER);
 }
 
@@ -122,26 +306,77 @@
 COMBOEX_ReSize (HWND hwnd, COMBOEX_INFO *infoPtr)
 {
-    HFONT nfont, ofont;
-    HDC mydc;
     SIZE mysize;
     UINT cy;
     IMAGEINFO iinfo;
 
-    mydc = GetDC (0); /* why the entire screen???? */
-    nfont = SendMessageA (infoPtr->hwndCombo, WM_GETFONT, 0, 0);
-    ofont = (HFONT) SelectObject (mydc, nfont);
-    GetTextExtentPointA (mydc, "A", 1, &mysize);
-    SelectObject (mydc, ofont);
-    ReleaseDC (0, mydc);
+    COMBOEX_GetComboFontSize (infoPtr, &mysize);
     cy = mysize.cy + CBE_EXTRA;
     if (infoPtr->himl) {
-    ImageList_GetImageInfo(infoPtr->himl, 0, &iinfo);
-    cy = max (iinfo.rcImage.bottom - iinfo.rcImage.top, cy);
-    }
-    TRACE("selected font hwnd=%08x, height=%d\n", nfont, cy);
-    SendMessageA (hwnd, CB_SETITEMHEIGHT, (WPARAM) -1, (LPARAM) cy);
+	ImageList_GetImageInfo(infoPtr->himl, 0, &iinfo);
+	cy = max (iinfo.rcImage.bottom - iinfo.rcImage.top, cy);
+	TRACE("upgraded height due to image:  height=%d\n", cy);
+    }
+    SendMessageW (hwnd, CB_SETITEMHEIGHT, (WPARAM) -1, (LPARAM) cy);
     if (infoPtr->hwndCombo)
-        SendMessageA (infoPtr->hwndCombo, CB_SETITEMHEIGHT,
-              (WPARAM) 0, (LPARAM) cy);
+        SendMessageW (infoPtr->hwndCombo, CB_SETITEMHEIGHT,
+		      (WPARAM) 0, (LPARAM) cy);
+}
+
+
+static void
+COMBOEX_SetEditText (COMBOEX_INFO *infoPtr, CBE_ITEMDATA *item)
+{
+    if (!infoPtr->hwndEdit) return;
+    /* native issues the following messages to the {Edit} control */
+    /*      WM_SETTEXT (0,addr)     */
+    /*      EM_SETSEL32 (0,0)       */
+    /*      EM_SETSEL32 (0,-1)      */
+    if (item->mask & CBEIF_TEXT) {
+	SendMessageW (infoPtr->hwndEdit, WM_SETTEXT, 0, (LPARAM)item->pszText);
+	SendMessageW (infoPtr->hwndEdit, EM_SETSEL, 0, 0);
+	SendMessageW (infoPtr->hwndEdit, EM_SETSEL, 0, -1);
+    }
+}
+
+ 
+static CBE_ITEMDATA *
+COMBOEX_FindItem(COMBOEX_INFO *infoPtr, INT index)
+{
+    CBE_ITEMDATA *item;
+    INT i;
+
+    if ((index > infoPtr->nb_items) || (index < -1))
+	return 0;
+    if (index == -1)
+	return infoPtr->edit;
+    item = infoPtr->items;
+    i = infoPtr->nb_items - 1;
+
+    /* find the item in the list */
+    while (item && (i > index)) {
+	item = (CBE_ITEMDATA *)item->next;
+	i--;
+    }
+    if (!item || (i != index)) {
+	FIXME("COMBOBOXEX item structures broken. Please report!\n");
+	return 0;
+    }
+    return item;
+}
+
+
+static void
+COMBOEX_WarnCallBack (CBE_ITEMDATA *item)
+{
+    if (item->pszText == LPSTR_TEXTCALLBACKW)
+	FIXME("Callback not implemented yet for pszText\n");
+    if (item->iImage == I_IMAGECALLBACK)
+	FIXME("Callback not implemented yet for iImage\n");
+    if (item->iSelectedImage == I_IMAGECALLBACK)
+	FIXME("Callback not implemented yet for iSelectedImage\n");
+    if (item->iOverlay == I_IMAGECALLBACK)
+	FIXME("Callback not implemented yet for iOverlay\n");
+    if (item->iIndent == I_INDENTCALLBACK)
+	FIXME("Callback not implemented yet for iIndent\n");
 }
 
@@ -150,5 +385,29 @@
 
 
-/* << COMBOEX_DeleteItem >> */
+static LRESULT
+COMBOEX_DeleteItem (HWND hwnd, WPARAM wParam, LPARAM lParam)
+{
+    COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
+    INT index = (INT) wParam;
+    CBE_ITEMDATA *item;
+
+    TRACE("(0x%08x 0x%08lx)\n", wParam, lParam);
+
+    /* if item number requested does not exist then return failure */
+    if ((index > infoPtr->nb_items) || (index < 0)) {
+	ERR("attempt to delete item that does not exist\n");
+	return CB_ERR;
+    }
+
+    if (!(item = COMBOEX_FindItem(infoPtr, index))) {
+	ERR("attempt to delete item that was not found!\n");
+	return CB_ERR;
+    }
+
+    /* doing this will result in WM_DELETEITEM being issued */
+    SendMessageW (infoPtr->hwndCombo, CB_DELETESTRING, (WPARAM)index, 0);
+
+    return infoPtr->nb_items;
+}
 
 
@@ -170,9 +429,9 @@
 
     if ((GetWindowLongA (hwnd, GWL_STYLE) & CBS_DROPDOWNLIST) != CBS_DROPDOWN)
-    return 0;
-
-    TRACE("-- 0x%x\n", GetDlgItem (infoPtr->hwndCombo, ID_CB_EDIT));
-
-    return (LRESULT)GetDlgItem (infoPtr->hwndCombo, ID_CB_EDIT);
+	return 0;
+
+    TRACE("-- 0x%x\n", infoPtr->hwndEdit);
+
+    return (LRESULT)infoPtr->hwndEdit;
 }
 
@@ -183,4 +442,6 @@
     COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
 
+    TRACE("-- 0x%08lx\n", infoPtr->dwExtStyle);
+
     return (LRESULT)infoPtr->dwExtStyle;
 }
@@ -192,5 +453,5 @@
     COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
 
-    TRACE("(0x%08x 0x%08lx)\n", wParam, lParam);
+    TRACE("-- 0x%p\n", infoPtr->himl);
 
     return (LRESULT)infoPtr->himl;
@@ -198,21 +459,105 @@
 
 
-/* << COMBOEX_GetItemA >> */
-
-/* << COMBOEX_GetItemW >> */
-
-/* << COMBOEX_GetUniCodeFormat >> */
-
-/* << COMBOEX_HasEditChanged >> */
-
-
 static LRESULT
-COMBOEX_InsertItemA (HWND hwnd, WPARAM wParam, LPARAM lParam)
+COMBOEX_GetItemW (HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
     COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
-    COMBOBOXEXITEMA *cit = (COMBOBOXEXITEMA *) lParam;
+    COMBOBOXEXITEMW *cit = (COMBOBOXEXITEMW *) lParam;
     INT index;
     CBE_ITEMDATA *item;
 
+    TRACE("(0x%08x 0x%08lx)\n", wParam, lParam);
+
+    /* get real index of item to insert */
+    index = cit->iItem;
+
+    /* if item number requested does not exist then return failure */
+    if ((index > infoPtr->nb_items) || (index < -1)) {
+	ERR("attempt to get item that does not exist\n");
+	return 0;
+    }
+
+    /* if the item is the edit control and there is no edit control, skip */
+    if ((index == -1) && 
+        ((GetWindowLongA (hwnd, GWL_STYLE) & CBS_DROPDOWNLIST) != CBS_DROPDOWN))
+	    return 0;
+
+    if (!(item = COMBOEX_FindItem(infoPtr, index))) {
+	ERR("attempt to get item that was not found!\n");
+	return 0;
+    }
+
+    COMBOEX_CopyItem (infoPtr, item, cit);
+
+    return TRUE;
+}
+
+
+inline static LRESULT
+COMBOEX_GetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam)
+{
+    COMBOBOXEXITEMA *cit = (COMBOBOXEXITEMA *) lParam;
+    COMBOBOXEXITEMW tmpcit;
+    INT len;
+
+    TRACE("(0x%08x 0x%08lx)\n", wParam, lParam);
+
+    tmpcit.mask = cit->mask;
+    tmpcit.iItem = cit->iItem;
+    COMBOEX_GetItemW (hwnd, wParam, (LPARAM) &tmpcit);
+
+    len = WideCharToMultiByte (CP_ACP, 0, tmpcit.pszText, -1, 0, 0, NULL, NULL);
+    if (len > 0) 
+	WideCharToMultiByte (CP_ACP, 0, tmpcit.pszText, -1, 
+			     cit->pszText, cit->cchTextMax, NULL, NULL);
+
+    cit->iImage = tmpcit.iImage;
+    cit->iSelectedImage = tmpcit.iSelectedImage;
+    cit->iOverlay = tmpcit.iOverlay;
+    cit->iIndent = tmpcit.iIndent;
+    cit->lParam = tmpcit.lParam;
+
+    return TRUE;
+}
+
+
+inline static LRESULT
+COMBOEX_GetUnicodeFormat (HWND hwnd, WPARAM wParam, LPARAM lParam)
+{
+    COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
+
+    TRACE("%s hwnd=0x%x stub!\n", 
+	   infoPtr->bUnicode ? "TRUE" : "FALSE", hwnd);
+
+    return infoPtr->bUnicode;
+}
+
+
+inline static LRESULT
+COMBOEX_HasEditChanged (HWND hwnd, WPARAM wParam, LPARAM lParam)
+{
+    COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
+
+    if ((GetWindowLongA (hwnd, GWL_STYLE) & CBS_DROPDOWNLIST) != CBS_DROPDOWN)
+	return FALSE;
+    if ((infoPtr->flags & (WCBE_ACTEDIT | WCBE_EDITCHG)) == 
+	(WCBE_ACTEDIT | WCBE_EDITCHG))
+	return TRUE;
+    return FALSE;
+}
+
+
+static LRESULT
+COMBOEX_InsertItemW (HWND hwnd, WPARAM wParam, LPARAM lParam)
+{
+    COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
+    COMBOBOXEXITEMW *cit = (COMBOBOXEXITEMW *) lParam;
+    INT index;
+    CBE_ITEMDATA *item;
+    NMCOMBOBOXEXW nmcit;
+
+    TRACE("\n");
+
+    COMBOEX_DumpInput ((COMBOBOXEXITEMA *) cit, TRUE);
 
     /* get real index of item to insert */
@@ -230,20 +575,21 @@
         /* fast path for iItem = -1 */
         item->next = infoPtr->items;
-    infoPtr->items = item;
+	infoPtr->items = item;
     }
     else {
-        int i = infoPtr->nb_items-1;
-    CBE_ITEMDATA *moving = infoPtr->items;
-
-    while (i > index && moving) {
-        moving = (CBE_ITEMDATA *)moving->next;
-    }
-    if (!moving) {
-        FIXME("COMBOBOXEX item structures broken. Please report!\n");
-        COMCTL32_Free(item);
-        return -1;
-    }
-    item->next = moving->next;
-    moving->next = item;
+        INT i = infoPtr->nb_items-1;
+	CBE_ITEMDATA *moving = infoPtr->items;
+
+	while ((i > index) && moving) {
+	    moving = (CBE_ITEMDATA *)moving->next;
+	    i--;
+	}
+	if (!moving) {
+	    FIXME("COMBOBOXEX item structures broken. Please report!\n");
+	    COMCTL32_Free(item);
+	    return -1;
+	}
+	item->next = moving->next;
+	moving->next = item;
     }
 
@@ -251,14 +597,14 @@
     item->mask           = cit->mask;
     if (item->mask & CBEIF_TEXT) {
-        LPSTR str;
-    INT len;
+        LPWSTR str;
+	INT len;
 
         str = cit->pszText;
-        if (!str) str="";
-    len = MultiByteToWideChar (CP_ACP, 0, str, -1, NULL, 0);
-    if (len > 0) {
-        item->pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
-        MultiByteToWideChar (CP_ACP, 0, str, -1, item->pszText, len);
-    }
+        if (!str) str = (LPWSTR) L"";
+	len = strlenW (str);
+	if (len > 0) {
+	    item->pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
+	    strcpyW (item->pszText, str);
+	}
         item->cchTextMax   = cit->cchTextMax;
     }
@@ -275,8 +621,13 @@
     infoPtr->nb_items++;
 
+    COMBOEX_WarnCallBack (item);
+
     COMBOEX_DumpItem (item);
 
-    SendMessageA (infoPtr->hwndCombo, CB_INSERTSTRING,
-          (WPARAM)cit->iItem, (LPARAM)item);
+    SendMessageW (infoPtr->hwndCombo, CB_INSERTSTRING, 
+		  (WPARAM)cit->iItem, (LPARAM)item);
+
+    COMBOEX_CopyItem (infoPtr, item, &nmcit.ceItem);
+    COMBOEX_Notify (infoPtr, CBEN_INSERTITEM, (NMHDR *)&nmcit, TRUE);
 
     return index;
@@ -286,5 +637,92 @@
 
 static LRESULT
-COMBOEX_InsertItemW (HWND hwnd, WPARAM wParam, LPARAM lParam)
+COMBOEX_InsertItemA (HWND hwnd, WPARAM wParam, LPARAM lParam)
+{
+    COMBOBOXEXITEMA	*cit = (COMBOBOXEXITEMA *) lParam;
+    COMBOBOXEXITEMW	citW;
+    LRESULT		ret;
+
+    memcpy(&citW,cit,sizeof(COMBOBOXEXITEMA));
+    if (cit->mask & CBEIF_TEXT) {
+        LPSTR str;
+	INT len;
+
+        str = cit->pszText;
+        if (!str) str="";
+	len = MultiByteToWideChar (CP_ACP, 0, str, -1, NULL, 0);
+	if (len > 0) {
+	    citW.pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
+	    MultiByteToWideChar (CP_ACP, 0, str, -1, citW.pszText, len);
+	}
+    }
+    ret = COMBOEX_InsertItemW(hwnd,wParam,(LPARAM)&citW);;
+
+    if (cit->mask & CBEIF_TEXT)
+	COMCTL32_Free(citW.pszText);
+    return ret;
+}
+
+
+static LRESULT
+COMBOEX_SetExtendedStyle (HWND hwnd, WPARAM wParam, LPARAM lParam)
+{
+    COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
+    DWORD dwTemp;
+
+    TRACE("(0x%08x 0x%08lx)\n", wParam, lParam);
+
+    dwTemp = infoPtr->dwExtStyle;
+
+    if (lParam & (CBES_EX_NOEDITIMAGEINDENT |
+		  CBES_EX_PATHWORDBREAKPROC |
+		  CBES_EX_NOSIZELIMIT |
+		  CBES_EX_CASESENSITIVE))
+	FIXME("Extended style not implemented %08lx\n", lParam);
+
+    if ((DWORD)wParam) {
+	infoPtr->dwExtStyle = (infoPtr->dwExtStyle & ~(DWORD)wParam) | (DWORD)lParam;
+    }
+    else
+	infoPtr->dwExtStyle = (DWORD)lParam;
+
+    /*
+     * native does this for CBES_EX_NOEDITIMAGE state change
+     */
+    if ((infoPtr->dwExtStyle & CBES_EX_NOEDITIMAGE) ^
+	(dwTemp & CBES_EX_NOEDITIMAGE)) {
+	/* if state of EX_NOEDITIMAGE changes, invalidate all */
+	TRACE("EX_NOEDITIMAGE state changed to %ld\n",
+	    infoPtr->dwExtStyle & CBES_EX_NOEDITIMAGE);
+	InvalidateRect (hwnd, NULL, TRUE);
+	COMBOEX_AdjustEditPos (infoPtr);
+	if (infoPtr->hwndEdit)
+	    InvalidateRect (infoPtr->hwndEdit, NULL, TRUE);
+    }
+
+    return (LRESULT)dwTemp;
+}
+
+
+inline static LRESULT
+COMBOEX_SetImageList (HWND hwnd, WPARAM wParam, LPARAM lParam)
+{
+    COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
+    HIMAGELIST himlTemp;
+
+    TRACE("(0x%08x 0x%08lx)\n", wParam, lParam);
+
+    himlTemp = infoPtr->himl;
+    infoPtr->himl = (HIMAGELIST)lParam;
+
+    COMBOEX_ReSize (hwnd, infoPtr);
+    InvalidateRect (infoPtr->hwndCombo, NULL, TRUE);
+
+    /* reposition the Edit control based on whether icon exists */
+    COMBOEX_AdjustEditPos (infoPtr);
+    return (LRESULT)himlTemp;
+}
+
+static LRESULT
+COMBOEX_SetItemW (HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
     COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
@@ -293,158 +731,39 @@
     CBE_ITEMDATA *item;
 
+    COMBOEX_DumpInput ((COMBOBOXEXITEMA *) cit, TRUE);
+
     /* get real index of item to insert */
     index = cit->iItem;
-    if (index == -1) index = infoPtr->nb_items;
-    if (index > infoPtr->nb_items) index = infoPtr->nb_items;
-
-    /* get space and chain it in */
-    item = (CBE_ITEMDATA *)COMCTL32_Alloc (sizeof (CBE_ITEMDATA));
-    item->next = NULL;
-    item->pszText = NULL;
-
-    /* locate position to insert new item in */
-    if (index == infoPtr->nb_items) {
-        /* fast path for iItem = -1 */
-        item->next = infoPtr->items;
-    infoPtr->items = item;
-    }
-    else {
-        INT i = infoPtr->nb_items-1;
-    CBE_ITEMDATA *moving = infoPtr->items;
-
-    while ((i > index) && moving) {
-        moving = (CBE_ITEMDATA *)moving->next;
-        i--;
-    }
-    if (!moving) {
-        FIXME("COMBOBOXEX item structures broken. Please report!\n");
-        COMCTL32_Free(item);
-        return -1;
-    }
-    item->next = moving->next;
-    moving->next = item;
-    }
-
-    /* fill in our hidden item structure */
-    item->mask           = cit->mask;
-    if (item->mask & CBEIF_TEXT) {
-        LPWSTR str;
-    INT len;
-
-        str = cit->pszText;
-        if (!str) str = (LPWSTR) L"";
-    len = strlenW (str);
-    if (len > 0) {
-        item->pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
-        strcpyW (item->pszText, str);
-    }
-        item->cchTextMax   = cit->cchTextMax;
-    }
-    if (item->mask & CBEIF_IMAGE)
-      item->iImage         = cit->iImage;
-    if (item->mask & CBEIF_SELECTEDIMAGE)
-      item->iSelectedImage = cit->iSelectedImage;
-    if (item->mask & CBEIF_OVERLAY)
-      item->iOverlay       = cit->iOverlay;
-    if (item->mask & CBEIF_INDENT)
-      item->iIndent        = cit->iIndent;
-    if (item->mask & CBEIF_LPARAM)
-      item->lParam         = cit->lParam;
-    infoPtr->nb_items++;
-
-    COMBOEX_DumpItem (item);
-
-    SendMessageA (infoPtr->hwndCombo, CB_INSERTSTRING,
-          (WPARAM)cit->iItem, (LPARAM)item);
-
-    return index;
-
-}
-
-
-static LRESULT
-COMBOEX_SetExtendedStyle (HWND hwnd, WPARAM wParam, LPARAM lParam)
-{
-    COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
-    DWORD dwTemp;
-
-    TRACE("(0x%08x 0x%08lx)\n", wParam, lParam);
-
-    dwTemp = infoPtr->dwExtStyle;
-
-    if ((DWORD)wParam) {
-    infoPtr->dwExtStyle = (infoPtr->dwExtStyle & ~(DWORD)wParam) | (DWORD)lParam;
-    }
-    else
-    infoPtr->dwExtStyle = (DWORD)lParam;
-
-    /* FIXME: repaint?? */
-
-    return (LRESULT)dwTemp;
-}
-
-
-inline static LRESULT
-COMBOEX_SetImageList (HWND hwnd, WPARAM wParam, LPARAM lParam)
-{
-    COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
-    HIMAGELIST himlTemp;
-
-    TRACE("(0x%08x 0x%08lx)\n", wParam, lParam);
-
-    himlTemp = infoPtr->himl;
-    infoPtr->himl = (HIMAGELIST)lParam;
-
-    COMBOEX_ReSize (hwnd, infoPtr);
-    InvalidateRect (hwnd, NULL, TRUE);
-
-    return (LRESULT)himlTemp;
-}
-
-static LRESULT
-COMBOEX_SetItemW (HWND hwnd, WPARAM wParam, LPARAM lParam)
-{
-    COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
-    COMBOBOXEXITEMW *cit = (COMBOBOXEXITEMW *) lParam;
-    INT index;
-    INT i;
-    CBE_ITEMDATA *item;
-
-    /* get real index of item to insert */
-    index = cit->iItem;
-    if (index == -1) {
-        FIXME("NYI setting data for item in edit control\n");
-    return 0;
-    }
 
     /* if item number requested does not exist then return failure */
-    if ((index > infoPtr->nb_items) || (index < 0)) return 0;
-
-    /* find the item in the list */
-    item = infoPtr->items;
-    i = infoPtr->nb_items - 1;
-    while (item && (i > index)) {
-        item = (CBE_ITEMDATA *)item->next;
-    i--;
-    }
-    if (!item || (i != index)) {
-    FIXME("COMBOBOXEX item structures broken. Please report!\n");
-    return 0;
-    }
-
-    /* add/change stuff to the internal item structure */
+    if ((index > infoPtr->nb_items) || (index < -1)) {
+	ERR("attempt to set item that does not exist yet!\n");
+	return 0;
+    }
+
+    /* if the item is the edit control and there is no edit control, skip */
+    if ((index == -1) && 
+        ((GetWindowLongA (hwnd, GWL_STYLE) & CBS_DROPDOWNLIST) != CBS_DROPDOWN))
+	    return 0;
+
+    if (!(item = COMBOEX_FindItem(infoPtr, index))) {
+	ERR("attempt to set item that was not found!\n");
+	return 0;
+    }
+
+    /* add/change stuff to the internal item structure */ 
     item->mask |= cit->mask;
     if (cit->mask & CBEIF_TEXT) {
         LPWSTR str;
-    INT len;
-    WCHAR emptystr[1] = {0};
+	INT len;
+	WCHAR emptystr[1] = {0};
 
         str = cit->pszText;
         if (!str) str=emptystr;
-    len = strlenW(str);
-    if (len > 0) {
-        item->pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
-        strcpyW(item->pszText,str);
-    }
+	len = strlenW(str);
+	if (len > 0) {
+	    item->pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
+	    strcpyW(item->pszText,str);
+	}
         item->cchTextMax   = cit->cchTextMax;
     }
@@ -460,6 +779,13 @@
       cit->lParam         = cit->lParam;
 
+    COMBOEX_WarnCallBack (item);
+
     COMBOEX_DumpItem (item);
 
+    /* if original request was to update edit control, do some fast foot work */
+    if (cit->iItem == -1) {
+	COMBOEX_SetEditText (infoPtr, item);
+	RedrawWindow (infoPtr->hwndCombo, 0, 0, RDW_ERASE | RDW_INVALIDATE);
+    }
     return TRUE;
 }
@@ -468,33 +794,111 @@
 COMBOEX_SetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
-    COMBOBOXEXITEMA *cit = (COMBOBOXEXITEMA *) lParam;
-    COMBOBOXEXITEMW citW;
-    LRESULT     ret;
+    COMBOBOXEXITEMA	*cit = (COMBOBOXEXITEMA *) lParam;
+    COMBOBOXEXITEMW	citW;
+    LRESULT		ret;
 
     memcpy(&citW,cit,sizeof(COMBOBOXEXITEMA));
     if (cit->mask & CBEIF_TEXT) {
         LPSTR str;
-    INT len;
+	INT len;
 
         str = cit->pszText;
         if (!str) str="";
-    len = MultiByteToWideChar (CP_ACP, 0, str, -1, NULL, 0);
-    if (len > 0) {
-        citW.pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
-        MultiByteToWideChar (CP_ACP, 0, str, -1, citW.pszText, len);
-    }
+	len = MultiByteToWideChar (CP_ACP, 0, str, -1, NULL, 0);
+	if (len > 0) {
+	    citW.pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
+	    MultiByteToWideChar (CP_ACP, 0, str, -1, citW.pszText, len);
+	}
     }
     ret = COMBOEX_SetItemW(hwnd,wParam,(LPARAM)&citW);;
 
     if (cit->mask & CBEIF_TEXT)
-    COMCTL32_Free(citW.pszText);
+	COMCTL32_Free(citW.pszText);
     return ret;
 }
 
 
-/* << COMBOEX_SetUniCodeFormat >> */
+inline static LRESULT
+COMBOEX_SetUnicodeFormat (HWND hwnd, WPARAM wParam, LPARAM lParam)
+{
+    COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
+    BOOL bTemp;
+
+    TRACE("%s hwnd=0x%04x stub!\n", 
+	   ((BOOL)wParam) ? "TRUE" : "FALSE", hwnd);
+
+    bTemp = infoPtr->bUnicode;
+    infoPtr->bUnicode = (BOOL)wParam;
+
+    return bTemp;
+}
+
 
 
 /* ***  CB_xxx message support  *** */
+
+
+static LRESULT
+COMBOEX_FindStringExact (COMBOEX_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
+{
+    INT i, count;
+    CBE_ITEMDATA *item;
+    LPWSTR desired = NULL;
+    INT start = (INT) wParam;
+
+    i = MultiByteToWideChar (CP_ACP, 0, (LPSTR)lParam, -1, NULL, 0);
+    if (i > 0) {
+	desired = (LPWSTR)COMCTL32_Alloc ((i + 1)*sizeof(WCHAR));
+	MultiByteToWideChar (CP_ACP, 0, (LPSTR)lParam, -1, desired, i);
+    }
+
+    count = SendMessageW (infoPtr->hwndCombo, CB_GETCOUNT, 0 , 0);
+
+    /* now search from after starting loc and wrapping back to start */
+    for(i=start+1; i<count; i++) {
+	item = (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo, 
+			  CB_GETITEMDATA, (WPARAM)i, 0);
+	TRACE("desired=%s, item=%s\n", 
+	      debugstr_w(desired), debugstr_w(item->pszText));
+	if (lstrcmpiW(item->pszText, desired) == 0) {
+	    COMCTL32_Free (desired);
+	    return i;
+	}
+    }
+    for(i=0; i<=start; i++) {
+	item = (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo, 
+			  CB_GETITEMDATA, (WPARAM)i, 0);
+	TRACE("desired=%s, item=%s\n", 
+	      debugstr_w(desired), debugstr_w(item->pszText));
+	if (lstrcmpiW(item->pszText, desired) == 0) {
+	    COMCTL32_Free (desired);
+	    return i;
+	}
+    }
+    COMCTL32_Free(desired);
+    return CB_ERR;
+}
+
+
+static LRESULT
+COMBOEX_SetCursel (HWND hwnd, WPARAM wParam, LPARAM lParam)
+{
+    INT index = wParam;
+    COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
+    CBE_ITEMDATA *item;
+    LRESULT lret;
+
+    if (!(item = COMBOEX_FindItem(infoPtr, index))) {
+	/* FIXME: need to clear selection */
+	return CB_ERR;
+    }
+
+    TRACE("selecting item %d text=%s\n", index, (item->pszText) ?
+	  debugstr_w(item->pszText) : "<null>");
+
+    lret = SendMessageW (infoPtr->hwndCombo, CB_SETCURSEL, wParam, lParam);
+    COMBOEX_SetEditText (infoPtr, item);
+    return lret;
+}
 
 
@@ -509,26 +913,24 @@
     /* First, lets forward the message to the normal combo control
        just like Windows.     */
-    if (infoPtr->hwndCombo)
-       SendMessageA (infoPtr->hwndCombo, CB_SETITEMHEIGHT, wParam, lParam);
-
-    /* *** new *** */
+    if (infoPtr->hwndCombo)    
+       SendMessageW (infoPtr->hwndCombo, CB_SETITEMHEIGHT, wParam, lParam);
+
     GetWindowRect (infoPtr->hwndCombo, &cb_wrect);
     GetWindowRect (hwnd, &cbx_wrect);
     GetClientRect (hwnd, &cbx_crect);
-    /* the height of comboex as height of the combo + comboex border */
+    /* the height of comboex as height of the combo + comboex border */ 
     height = cb_wrect.bottom-cb_wrect.top
              + cbx_wrect.bottom-cbx_wrect.top
              - (cbx_crect.bottom-cbx_crect.top);
     TRACE("EX window=(%d,%d)-(%d,%d), client=(%d,%d)-(%d,%d)\n",
-      cbx_wrect.left, cbx_wrect.top, cbx_wrect.right, cbx_wrect.bottom,
-      cbx_crect.left, cbx_crect.top, cbx_crect.right, cbx_crect.bottom);
+	  cbx_wrect.left, cbx_wrect.top, cbx_wrect.right, cbx_wrect.bottom,
+	  cbx_crect.left, cbx_crect.top, cbx_crect.right, cbx_crect.bottom);
     TRACE("CB window=(%d,%d)-(%d,%d), EX setting=(0,0)-(%d,%d)\n",
-      cb_wrect.left, cb_wrect.top, cb_wrect.right, cb_wrect.bottom,
-      cbx_wrect.right-cbx_wrect.left, height);
+	  cb_wrect.left, cb_wrect.top, cb_wrect.right, cb_wrect.bottom,
+	  cbx_wrect.right-cbx_wrect.left, height);
     SetWindowPos (hwnd, HWND_TOP, 0, 0,
-          cbx_wrect.right-cbx_wrect.left,
-          height,
-          SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE);
-    /* *** end new *** */
+		  cbx_wrect.right-cbx_wrect.left,
+		  height,
+		  SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE);
 
     return ret;
@@ -546,40 +948,375 @@
     DWORD dwComboStyle;
     LOGFONTA mylogfont;
+    CBE_ITEMDATA *item;
+    RECT wnrc1, clrc1, cmbwrc;
+    LONG test;
 
     /* allocate memory for info structure */
+#ifdef __WIN32OS2__
+    infoPtr = (COMBOEX_INFO*)initControl(hwnd,sizeof(COMBOEX_INFO));
+#else
     infoPtr = (COMBOEX_INFO *)COMCTL32_Alloc (sizeof(COMBOEX_INFO));
+#endif
     if (infoPtr == NULL) {
-    ERR("could not allocate info memory!\n");
-    return 0;
-    }
+	ERR("could not allocate info memory!\n");
+	return 0;
+    }
+
+    /* initialize info structure */
+
     infoPtr->items    = NULL;
     infoPtr->nb_items = 0;
+    infoPtr->hwndSelf = hwnd;
 
     SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
-
-
-    /* initialize info structure */
-
 
     /* create combo box */
     dwComboStyle = GetWindowLongA (hwnd, GWL_STYLE) &
-            (CBS_SIMPLE|CBS_DROPDOWN|CBS_DROPDOWNLIST|WS_CHILD);
+			(CBS_SIMPLE|CBS_DROPDOWN|CBS_DROPDOWNLIST|WS_CHILD);
+
+    TRACE("combo style=%08lx, additional style=%08lx\n", dwComboStyle,
+          WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VSCROLL |
+          CBS_NOINTEGRALHEIGHT | CBS_DROPDOWNLIST |
+	  WS_CHILD | WS_VISIBLE | CBS_OWNERDRAWFIXED);
+
+    /* Native version of ComboEx creates the ComboBox with DROPDOWNLIST */
+    /* specified. It then creates it's own version of the EDIT control  */
+    /* and makes the ComboBox the parent. This is because a normal      */
+    /* DROPDOWNLIST does not have a EDIT control, but we need one.      */
+    /* We also need to place the edit control at the proper location    */
+    /* (allow space for the icons).                                     */
 
     infoPtr->hwndCombo = CreateWindowA ("ComboBox", "",
-             /* following line added to match native */
-                         WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VSCROLL | CBS_NOINTEGRALHEIGHT |
-             /* was base and is necessary */
-             WS_CHILD | WS_VISIBLE | CBS_OWNERDRAWFIXED | dwComboStyle,
-            cs->y, cs->x, cs->cx, cs->cy, hwnd, (HMENU)0,
-            GetWindowLongA (hwnd, GWL_HINSTANCE), NULL);
-
-    /* *** new *** */
-    SystemParametersInfoA (SPI_GETICONTITLELOGFONT, sizeof(mylogfont), &mylogfont, 0);
-    infoPtr->font = CreateFontIndirectA (&mylogfont);
-    SendMessageA (infoPtr->hwndCombo, WM_SETFONT, (WPARAM)infoPtr->font, 0);
+			 /* following line added to match native */
+                         WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VSCROLL |
+                         CBS_NOINTEGRALHEIGHT | CBS_DROPDOWNLIST | 
+			 /* was base and is necessary */
+			 WS_CHILD | WS_VISIBLE | CBS_OWNERDRAWFIXED | dwComboStyle,
+			 cs->y, cs->x, cs->cx, cs->cy, hwnd,
+			 (HMENU) GetWindowLongA (hwnd, GWL_ID),
+			 GetWindowLongA (hwnd, GWL_HINSTANCE), NULL);
+
+    /* 
+     * native does the following at this point according to trace:
+     *  GetWindowThreadProcessId(hwndCombo,0)
+     *  GetCurrentThreadId()
+     *  GetWindowThreadProcessId(hwndCombo, &???)
+     *  GetCurrentProcessId()
+     */
+
+    /*
+     * Setup a property to hold the pointer to the COMBOBOXEX 
+     * data structure.
+     */
+    test = GetPropA(infoPtr->hwndCombo, (LPCSTR)(LONG)ComboExInfo);
+    if (!test || ((COMBOEX_INFO *)test != infoPtr)) {
+	SetPropA(infoPtr->hwndCombo, "CC32SubclassInfo", (LONG)infoPtr);
+    }
+    infoPtr->prevComboWndProc = (WNDPROC)SetWindowLongA(infoPtr->hwndCombo, 
+	                        GWL_WNDPROC, (LONG)COMBOEX_ComboWndProc);
+    infoPtr->font = SendMessageW (infoPtr->hwndCombo, WM_GETFONT, 0, 0);
+
+
+    /*
+     * Now create our own EDIT control so we can position it.
+     * It is created only for CBS_DROPDOWN style
+     */
+    if ((cs->style & CBS_DROPDOWNLIST) == CBS_DROPDOWN) {
+	infoPtr->hwndEdit = CreateWindowExA (0, "EDIT", "",
+		    WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | ES_AUTOHSCROLL,
+		    0, 0, 0, 0,  /* will set later */
+		    infoPtr->hwndCombo, 
+		    (HMENU) GetWindowLongA (hwnd, GWL_ID),
+		    GetWindowLongA (hwnd, GWL_HINSTANCE),
+		    NULL);
+
+	/* native does the following at this point according to trace:
+	 *  GetWindowThreadProcessId(hwndEdit,0)
+	 *  GetCurrentThreadId()
+	 *  GetWindowThreadProcessId(hwndEdit, &???)
+	 *  GetCurrentProcessId()
+	 */
+
+	/*
+	 * Setup a property to hold the pointer to the COMBOBOXEX 
+	 * data structure.
+	 */
+	test = GetPropA(infoPtr->hwndEdit, (LPCSTR)(LONG)ComboExInfo);
+	if (!test || ((COMBOEX_INFO *)test != infoPtr)) {
+	    SetPropA(infoPtr->hwndEdit, "CC32SubclassInfo", (LONG)infoPtr);
+	}
+	infoPtr->prevEditWndProc = (WNDPROC)SetWindowLongA(infoPtr->hwndEdit, 
+				 GWL_WNDPROC, (LONG)COMBOEX_EditWndProc);
+	infoPtr->font = SendMessageW (infoPtr->hwndCombo, WM_GETFONT, 0, 0);
+    }
+    else {
+	infoPtr->hwndEdit = 0;
+	infoPtr->font = 0;
+    }
+
+    /*
+     * Locate the default font if necessary and then set it in
+     * all associated controls
+     */
+    if (!infoPtr->font) {
+	SystemParametersInfoA (SPI_GETICONTITLELOGFONT, sizeof(mylogfont), 
+			       &mylogfont, 0);
+	infoPtr->font = CreateFontIndirectA (&mylogfont);
+    }
+    SendMessageW (infoPtr->hwndCombo, WM_SETFONT, (WPARAM)infoPtr->font, 0);
+    if (infoPtr->hwndEdit) {
+	SendMessageW (infoPtr->hwndEdit, WM_SETFONT, (WPARAM)infoPtr->font, 0);
+	SendMessageW (infoPtr->hwndEdit, EM_SETMARGINS, (WPARAM)EC_USEFONTINFO, 0);
+    }
+
     COMBOEX_ReSize (hwnd, infoPtr);
-    /* *** end new *** */
+
+    /* Above is fairly certain, below is much less certain. */
+
+    GetWindowRect(hwnd, &wnrc1);
+    GetClientRect(hwnd, &clrc1);
+    GetWindowRect(infoPtr->hwndCombo, &cmbwrc);
+    TRACE("Ex wnd=(%d,%d)-(%d,%d) Ex clt=(%d,%d)-(%d,%d) Cb wnd=(%d,%d)-(%d,%d)\n",
+	  wnrc1.left, wnrc1.top, wnrc1.right, wnrc1.bottom,
+	  clrc1.left, clrc1.top, clrc1.right, clrc1.bottom,
+	  cmbwrc.left, cmbwrc.top, cmbwrc.right, cmbwrc.bottom);
+    SetWindowPos(infoPtr->hwndCombo, HWND_TOP, 
+		 0, 0, wnrc1.right-wnrc1.left, wnrc1.bottom-wnrc1.top,
+		 SWP_NOACTIVATE | SWP_NOREDRAW);
+
+    GetWindowRect(infoPtr->hwndCombo, &cmbwrc);
+    TRACE("Ex wnd=(%d,%d)-(%d,%d)\n",
+	  cmbwrc.left, cmbwrc.top, cmbwrc.right, cmbwrc.bottom);
+    SetWindowPos(hwnd, HWND_TOP, 
+		 0, 0, cmbwrc.right-cmbwrc.left, cmbwrc.bottom-cmbwrc.top,
+		 SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE);
+
+    COMBOEX_AdjustEditPos (infoPtr);
+
+    /*
+     * Create an item structure to represent the data in the 
+     * EDIT control.
+     */
+    item = (CBE_ITEMDATA *)COMCTL32_Alloc (sizeof (CBE_ITEMDATA));
+    item->next = NULL;
+    item->pszText = NULL;
+    item->mask = 0;
+    infoPtr->edit = item;
 
     return 0;
+}
+
+
+inline static LRESULT
+COMBOEX_Command (HWND hwnd, WPARAM wParam, LPARAM lParam)
+{
+    LRESULT lret;
+    COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
+    INT command = HIWORD(wParam);
+    CBE_ITEMDATA *item = 0;
+    WCHAR wintext[520];
+    INT cursel, n, oldItem;
+    NMCBEENDEDITA cbeend;
+
+    TRACE("for command %d\n", command);
+
+    switch (command)
+    {
+    case CBN_DROPDOWN:
+	SendMessageW (GetParent (hwnd), WM_COMMAND, wParam, 
+			     (LPARAM)hwnd);
+	/*
+	 * from native trace of first dropdown after typing in URL in IE4 
+	 *  CB_GETCURSEL(Combo)
+	 *  GetWindowText(Edit)
+	 *  CB_GETCURSEL(Combo)
+	 *  CB_GETCOUNT(Combo)
+	 *  CB_GETITEMDATA(Combo, n)
+	 *  WM_NOTIFY(parent, CBEN_ENDEDITA|W)
+	 *  CB_GETCURSEL(Combo)
+	 *  CB_SETCURSEL(COMBOEX, n)
+	 *  SetFocus(Combo)
+	 * the rest is supposition  
+	 */
+	cursel = SendMessageW (infoPtr->hwndCombo, CB_GETCURSEL, 0, 0);
+	if (cursel == -1) {
+	    /* find match from edit against those in Combobox */
+	    GetWindowTextW (infoPtr->hwndEdit, wintext, 520);
+	    n = SendMessageW (infoPtr->hwndCombo, CB_GETCOUNT, 0, 0);
+	    for (cursel = 0; cursel < n; cursel++){
+		item = (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo, 
+						     CB_GETITEMDATA, 
+						     cursel, 0);
+		if ((INT)item == CB_ERR) break;
+		if (lstrcmpiW(item->pszText, wintext) == 0) break;
+	    }
+	    if ((cursel == n) || ((INT)item == CB_ERR)) {
+		TRACE("failed to find match??? item=%p cursel=%d\n",
+		      item, cursel);
+		if (infoPtr->hwndEdit)
+		    SetFocus(infoPtr->hwndEdit);
+		return 0;
+	    }
+	}
+	else {
+	    item = (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo, 
+						 CB_GETITEMDATA, 
+						 cursel, 0);
+	    if ((INT)item == CB_ERR) {
+		TRACE("failed to find match??? item=%p cursel=%d\n",
+		      item, cursel);
+		if (infoPtr->hwndEdit)
+		    SetFocus(infoPtr->hwndEdit);
+		return 0;
+	    }
+	}
+	if (infoPtr->flags & WCBE_ACTEDIT) {
+	    WideCharToMultiByte (CP_ACP, 0, item->pszText, -1,
+				 cbeend.szText, sizeof(cbeend.szText),
+				 NULL, NULL);
+	    cbeend.fChanged = (infoPtr->flags & WCBE_EDITCHG);
+	    cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo,
+						 CB_GETCURSEL, 0, 0);
+	    cbeend.iWhy = CBENF_DROPDOWN;
+
+	    infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG);
+	    if (COMBOEX_Notify (infoPtr, CBEN_ENDEDITA, 
+				(NMHDR *)&cbeend, FALSE)) {
+		/* abort the change */
+		TRACE("Notify requested abort of change\n");
+		return 0;
+	    }
+	}
+	SendMessageW (hwnd, CB_SETCURSEL, cursel, 0);
+	SetFocus(infoPtr->hwndCombo);
+	return 0;
+
+    case CBN_SELCHANGE:
+	/*
+	 * CB_GETCURSEL(Combo)
+	 * CB_GETITEMDATA(Combo)   < simulated by COMBOEX_FindItem
+	 * lstrlenA
+	 * WM_SETTEXT(Edit)
+	 * WM_GETTEXTLENGTH(Edit)
+	 * WM_GETTEXT(Edit)
+	 * EM_SETSEL(Edit, 0,0)
+	 * WM_GETTEXTLENGTH(Edit)
+	 * WM_GETTEXT(Edit)
+	 * EM_SETSEL(Edit, 0,len)
+	 * return WM_COMMAND to parent
+	 */
+	oldItem = SendMessageW (infoPtr->hwndCombo, CB_GETCURSEL, 0, 0);
+	if (!(item = COMBOEX_FindItem(infoPtr, oldItem))) {
+	    ERR("item %d not found. Problem!\n", oldItem);
+	    break;
+	}  
+	COMBOEX_SetEditText (infoPtr, item);
+	return SendMessageW (GetParent (hwnd), WM_COMMAND, wParam, 
+			     (LPARAM)hwnd);
+
+    case CBN_SELENDOK:
+	/* 
+	 * We have to change the handle since we are the control
+	 * issuing the message. IE4 depends on this.
+	 */
+	return SendMessageW (GetParent (hwnd), WM_COMMAND, wParam, 
+			     (LPARAM)hwnd);
+
+    case CBN_KILLFOCUS:
+	/*
+	 * from native trace:
+	 *
+	 *  pass to parent
+	 *  WM_GETTEXT(Edit, 104)
+	 *  CB_GETCURSEL(Combo) rets -1
+	 *  WM_NOTIFY(CBEN_ENDEDITA) with CBENF_KILLFOCUS
+	 *  CB_GETCURSEL(Combo)
+	 *  InvalidateRect(Combo, 0, 0)
+	 *  return 0
+	 */
+	SendMessageW (GetParent (hwnd), WM_COMMAND, wParam, 
+			     (LPARAM)hwnd);
+	if (infoPtr->flags & WCBE_ACTEDIT) {
+	    GetWindowTextA (infoPtr->hwndEdit, cbeend.szText, 260);
+	    cbeend.fChanged = (infoPtr->flags & WCBE_EDITCHG);
+	    cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo,
+						 CB_GETCURSEL, 0, 0);
+	    cbeend.iWhy = CBENF_KILLFOCUS;
+
+	    infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG);
+	    if (COMBOEX_Notify (infoPtr, CBEN_ENDEDITA, 
+				(NMHDR *)&cbeend, FALSE)) {
+		/* abort the change */
+		TRACE("Notify requested abort of change\n");
+		return 0;
+	    }
+	}
+	/* possible CB_GETCURSEL */
+	InvalidateRect (infoPtr->hwndCombo, 0, 0);
+	return 0;
+
+    case CBN_CLOSEUP:
+    default:
+	/* 
+	 * We have to change the handle since we are the control
+	 * issuing the message. IE4 depends on this.
+	 * We also need to set the focus back to the Edit control
+	 * after passing the command to the parent of the ComboEx.
+	 */
+	lret = SendMessageW (GetParent (hwnd), WM_COMMAND, wParam, 
+			     (LPARAM)hwnd);
+	if (infoPtr->hwndEdit)
+	    SetFocus(infoPtr->hwndEdit);
+	return lret;
+    }
+    return 0;
+}
+
+
+inline static LRESULT
+COMBOEX_WM_DeleteItem (HWND hwnd, WPARAM wParam, LPARAM lParam)
+{
+    COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
+    DELETEITEMSTRUCT *dis = (DELETEITEMSTRUCT *)lParam;
+    CBE_ITEMDATA *item, *olditem;
+    INT i;
+    NMCOMBOBOXEXW nmcit;
+
+    TRACE("CtlType=%08x, CtlID=%08x, itemID=%08x, hwnd=%x, data=%08lx\n",
+	  dis->CtlType, dis->CtlID, dis->itemID, dis->hwndItem, dis->itemData);
+
+    if ((dis->itemID >= infoPtr->nb_items) || (dis->itemID < 0)) return FALSE;
+
+    olditem = infoPtr->items;
+    i = infoPtr->nb_items - 1;
+
+    if (i == dis->itemID) {
+	infoPtr->items = infoPtr->items->next;
+    }
+    else {
+	item = olditem;
+	i--;
+
+	/* find the prior item in the list */
+	while (item->next && (i > dis->itemID)) {
+	    item = (CBE_ITEMDATA *)item->next;
+	    i--;
+	}
+	if (!item->next || (i != dis->itemID)) {
+	    FIXME("COMBOBOXEX item structures broken. Please report!\n");
+	    return FALSE;
+	}
+	olditem = item->next;
+	item->next = (CBE_ITEMDATA *)((CBE_ITEMDATA *)item->next)->next;
+    }
+    infoPtr->nb_items--;
+
+    COMBOEX_CopyItem (infoPtr, olditem, &nmcit.ceItem);
+    COMBOEX_Notify (infoPtr, CBEN_DELETEITEM, (NMHDR *)&nmcit, TRUE);
+
+    COMCTL32_Free(olditem);
+
+    return TRUE;
+
 }
 
@@ -590,10 +1327,9 @@
     COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
     DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)lParam;
-    CBE_ITEMDATA *item;
+    CBE_ITEMDATA *item = 0;
     SIZE txtsize;
-    COLORREF nbkc, ntxc;
     RECT rect;
-    int drawimage;
-    UINT x, xbase, y;
+    int drawimage, drawstate;
+    UINT xbase;
     UINT xioff = 0;               /* size and spacer of image if any */
     IMAGEINFO iinfo;
@@ -614,46 +1350,98 @@
     /*      though the list box or combo box has the focus.             */
     if (dis->itemID == 0xffffffff) {
-      if ( ( (dis->itemAction & ODA_FOCUS) && (dis->itemState & ODS_SELECTED)) ||
-       ( (dis->itemAction & (ODA_SELECT | ODA_DRAWENTIRE)) && (dis->itemState & ODS_FOCUS) ) ) {
-        TRACE("drawing item -1 special focus, rect=(%d,%d)-(%d,%d)\n",
-          dis->rcItem.left, dis->rcItem.top,
-          dis->rcItem.right, dis->rcItem.bottom);
-    DrawFocusRect(dis->hDC, &dis->rcItem);
-    return 0;
-      }
-      else {
-    TRACE("NOT drawing item  -1 special focus, rect=(%d,%d)-(%d,%d), action=%08x, state=%08x\n",
-          dis->rcItem.left, dis->rcItem.top,
-          dis->rcItem.right, dis->rcItem.bottom,
-          dis->itemAction, dis->itemState);
-    return 0;
-      }
-    }
-
-    item = (CBE_ITEMDATA *)SendMessageA (infoPtr->hwndCombo, CB_GETITEMDATA,
-                     (WPARAM)dis->itemID, 0);
-    if (item == (CBE_ITEMDATA *)CB_ERR)
-    {
-        FIXME("invalid item for id %d \n",dis->itemID);
-        return 0;
-    }
+	if ( ( (dis->itemAction & ODA_FOCUS) && (dis->itemState & ODS_SELECTED)) ||
+	     ( (dis->itemAction & (ODA_SELECT | ODA_DRAWENTIRE)) && (dis->itemState & ODS_FOCUS) ) ) { 
+
+	    TRACE("drawing item -1 special focus, rect=(%d,%d)-(%d,%d)\n",
+		  dis->rcItem.left, dis->rcItem.top,
+		  dis->rcItem.right, dis->rcItem.bottom);
+	}
+	else if ((dis->CtlType == ODT_COMBOBOX) && 
+		 (dis->itemAction == ODA_DRAWENTIRE)) {
+	    /* draw of edit control data */
+
+	    /* testing */
+	    {
+		RECT exrc, cbrc, edrc;
+		GetWindowRect (hwnd, &exrc);
+		GetWindowRect (infoPtr->hwndCombo, &cbrc);
+		edrc.left=edrc.top=edrc.right=edrc.bottom=-1;
+		if (infoPtr->hwndEdit)
+		    GetWindowRect (infoPtr->hwndEdit, &edrc);
+		TRACE("window rects ex=(%d,%d)-(%d,%d), cb=(%d,%d)-(%d,%d), ed=(%d,%d)-(%d,%d)\n",
+		      exrc.left, exrc.top, exrc.right, exrc.bottom,
+		      cbrc.left, cbrc.top, cbrc.right, cbrc.bottom,
+		      edrc.left, edrc.top, edrc.right, edrc.bottom);
+	    }
+	}
+	else {
+	    ERR("NOT drawing item  -1 special focus, rect=(%d,%d)-(%d,%d), action=%08x, state=%08x\n",
+		dis->rcItem.left, dis->rcItem.top,
+		dis->rcItem.right, dis->rcItem.bottom,
+		dis->itemAction, dis->itemState);
+	    return 0;
+	}
+    }
+
+    /* If draw item is -1 (edit control) setup the item pointer */
+    if (dis->itemID == 0xffffffff) {
+	CHAR str[260];
+	INT wlen, alen;
+
+	if (!infoPtr->hwndEdit) {
+	    ERR("request to draw edit item, but no edit control exists!\n");
+	    return 0;
+	}
+
+	item = infoPtr->edit;
+	/* free previous text of edit item */
+	if (item->pszText) {
+	    COMCTL32_Free(item->pszText);
+	    item->pszText = 0;
+	    item->mask &= ~CBEIF_TEXT;
+	}
+	alen = SendMessageA (infoPtr->hwndEdit, WM_GETTEXT, 260, (LPARAM)&str);
+	TRACE("edit control hwndEdit=%0x, text len=%d str=<%s>\n",
+	      infoPtr->hwndEdit, alen, str);
+	if (alen > 0) {
+	    item->mask |= CBEIF_TEXT;
+	    wlen = MultiByteToWideChar (CP_ACP, 0, str, -1, NULL, 0);
+	    if (wlen > 0) {
+		item->pszText = (LPWSTR)COMCTL32_Alloc ((wlen + 1)*sizeof(WCHAR));
+		MultiByteToWideChar (CP_ACP, 0, str, -1, item->pszText, wlen);
+	    }
+	}
+    }
+
+    /* if the item pointer is not set, then get the data and locate it */
+    if (!item) {
+	item = (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo,
+			     CB_GETITEMDATA, (WPARAM)dis->itemID, 0);
+	if (item == (CBE_ITEMDATA *)CB_ERR)
+	    {
+		FIXME("invalid item for id %d \n",dis->itemID);
+		return 0;
+	    }
+    }
+
+    /* dump the DRAWITEMSTRUCT if tracing "comboex" but not "message" */
     if (!TRACE_ON(message)) {
-    TRACE("DRAWITEMSTRUCT: CtlType=0x%08x CtlID=0x%08x\n",
-          dis->CtlType, dis->CtlID);
-    TRACE("itemID=0x%08x itemAction=0x%08x itemState=0x%08x\n",
-          dis->itemID, dis->itemAction, dis->itemState);
-    TRACE("hWnd=0x%04x hDC=0x%04x (%d,%d)-(%d,%d) itemData=0x%08lx\n",
-          dis->hwndItem, dis->hDC, dis->rcItem.left,
-          dis->rcItem.top, dis->rcItem.right, dis->rcItem.bottom,
-          dis->itemData);
+	TRACE("DRAWITEMSTRUCT: CtlType=0x%08x CtlID=0x%08x\n", 
+	      dis->CtlType, dis->CtlID);
+	TRACE("itemID=0x%08x itemAction=0x%08x itemState=0x%08x\n", 
+	      dis->itemID, dis->itemAction, dis->itemState);
+	TRACE("hWnd=0x%04x hDC=0x%04x (%d,%d)-(%d,%d) itemData=0x%08lx\n",
+	      dis->hwndItem, dis->hDC, dis->rcItem.left, 
+	      dis->rcItem.top, dis->rcItem.right, dis->rcItem.bottom, 
+	      dis->itemData);
     }
     COMBOEX_DumpItem (item);
 
     xbase = CBE_STARTOFFSET;
-    if (item->mask & CBEIF_INDENT)
+    if ((item->mask & CBEIF_INDENT) && (dis->itemState & ODS_COMBOEXLBOX))
         xbase += (item->iIndent * CBE_INDENT);
     if (item->mask & CBEIF_IMAGE) {
-    ImageList_GetImageInfo(infoPtr->himl, item->iImage, &iinfo);
-    xioff = (iinfo.rcImage.right - iinfo.rcImage.left + CBE_SEP);
+	ImageList_GetImageInfo(infoPtr->himl, item->iImage, &iinfo);
+	xioff = (iinfo.rcImage.right - iinfo.rcImage.left + CBE_SEP);
     }
 
@@ -661,66 +1449,112 @@
     case ODA_FOCUS:
         if (dis->itemState & ODS_SELECTED /*1*/) {
-        if ((item->mask & CBEIF_TEXT) && item->pszText) {
-            len = strlenW (item->pszText);
-        GetTextExtentPointW (dis->hDC, item->pszText, len, &txtsize);
-        rect.left = xbase + xioff - 1;
-            rect.top = dis->rcItem.top - 1 +
-          (dis->rcItem.bottom - dis->rcItem.top - txtsize.cy) / 2;
-        rect.right = rect.left + txtsize.cx + 2;
-        rect.bottom = rect.top + txtsize.cy + 2;
-        TRACE("drawing item %d focus, rect=(%d,%d)-(%d,%d)\n",
-              dis->itemID, rect.left, rect.top,
-              rect.right, rect.bottom);
-        DrawFocusRect(dis->hDC, &rect);
-        }
-    }
+	    if ((item->mask & CBEIF_TEXT) && item->pszText) {
+		RECT rect2;
+
+	        len = strlenW (item->pszText);
+		GetTextExtentPointW (dis->hDC, item->pszText, len, &txtsize);
+		rect.left = xbase + xioff - 1;
+		rect.right = rect.left + txtsize.cx + 2;
+		rect.top = dis->rcItem.top;
+		rect.bottom = dis->rcItem.bottom;
+		GetClipBox (dis->hDC, &rect2);
+		TRACE("drawing item %d focus, rect=(%d,%d)-(%d,%d)\n",
+		      dis->itemID, rect.left, rect.top,
+		      rect.right, rect.bottom);
+		TRACE("                      clip=(%d,%d)-(%d,%d)\n",
+		      rect2.left, rect2.top,
+		      rect2.right, rect2.bottom);
+
+		DrawFocusRect(dis->hDC, &rect);
+	    }
+	    else {
+		FIXME("ODA_FOCUS and ODS_SELECTED but no text\n");
+	    }
+	}
+	else {
+	    FIXME("ODA_FOCUS but not ODS_SELECTED\n");
+	}
         break;
     case ODA_SELECT:
     case ODA_DRAWENTIRE:
         drawimage = -1;
-    if (item->mask & CBEIF_IMAGE) drawimage = item->iImage;
-    if ((dis->itemState & ODS_SELECTED) &&
-        (item->mask & CBEIF_SELECTEDIMAGE))
-            drawimage = item->iSelectedImage;
-    if (drawimage != -1) {
-        ImageList_Draw (infoPtr->himl, drawimage, dis->hDC,
-                xbase, dis->rcItem.top,
-                (dis->itemState & ODS_SELECTED) ?
-                ILD_SELECTED : ILD_NORMAL);
-    }
-    if ((item->mask & CBEIF_TEXT) && item->pszText) {
-        len = strlenW (item->pszText);
-        GetTextExtentPointW (dis->hDC, item->pszText, len, &txtsize);
-        nbkc = GetSysColor ((dis->itemState & ODS_SELECTED) ?
-                    COLOR_HIGHLIGHT : COLOR_WINDOW);
-        SetBkColor (dis->hDC, nbkc);
-        ntxc = GetSysColor ((dis->itemState & ODS_SELECTED) ?
-                    COLOR_HIGHLIGHTTEXT : COLOR_WINDOWTEXT);
-        SetTextColor (dis->hDC, ntxc);
-        x = xbase + xioff;
-        y = dis->rcItem.top +
-            (dis->rcItem.bottom - dis->rcItem.top - txtsize.cy) / 2;
-        rect.left = x;
-        rect.right = x + txtsize.cx;
-        rect.top = y;
-        rect.bottom = y + txtsize.cy;
-        TRACE("drawing item %d text, rect=(%d,%d)-(%d,%d)\n",
-          dis->itemID, rect.left, rect.top, rect.right, rect.bottom);
-        ExtTextOutW (dis->hDC, x, y, ETO_OPAQUE | ETO_CLIPPED,
-             &rect, item->pszText, len, 0);
-        if (dis->itemState & ODS_FOCUS) {
-            rect.top -= 1;
-        rect.bottom += 1;
-        rect.left -= 1;
-        rect.right += 2;
-        TRACE("drawing item %d focus, rect=(%d,%d)-(%d,%d)\n",
-              dis->itemID, rect.left, rect.top, rect.right, rect.bottom);
-        DrawFocusRect (dis->hDC, &rect);
-        }
-    }
-    break;
+	drawstate = ILD_NORMAL;
+	if (!(infoPtr->dwExtStyle & CBES_EX_NOEDITIMAGE)) {
+	    if (item->mask & CBEIF_IMAGE) 
+		drawimage = item->iImage;
+	    if (dis->itemState & ODS_COMBOEXLBOX) {
+		/* drawing listbox entry */
+		if (dis->itemState & ODS_SELECTED) {
+		    if (item->mask & CBEIF_SELECTEDIMAGE)
+			drawimage = item->iSelectedImage;
+		    drawstate = ILD_SELECTED;
+		}
+	    }
+	    else {
+		/* drawing combo/edit entry */
+		if (infoPtr->hwndEdit) {
+		    /* if we have an edit control, the slave the 
+                     * selection state to the Edit focus state 
+		     */
+		    if (infoPtr->flags & WCBE_EDITFOCUSED) {
+			if (item->mask & CBEIF_SELECTEDIMAGE)
+			    drawimage = item->iSelectedImage;
+			drawstate = ILD_SELECTED;
+		    }
+		}
+		else {
+		    /* if we don't have an edit control, use 
+		     * the requested state.
+		     */
+		    if (dis->itemState & ODS_SELECTED) {
+			if (item->mask & CBEIF_SELECTEDIMAGE)
+			    drawimage = item->iSelectedImage;
+			drawstate = ILD_SELECTED;
+		    }
+		}
+	    }
+	}
+	if (drawimage != -1) {
+	    TRACE("drawing image state=%d\n", dis->itemState & ODS_SELECTED);
+	    ImageList_Draw (infoPtr->himl, drawimage, dis->hDC, 
+			    xbase, dis->rcItem.top, drawstate);
+	}
+	if ((item->mask & CBEIF_TEXT) && item->pszText) { 
+	    UINT x, y;
+	    COLORREF nbkc, ntxc;
+
+	    len = lstrlenW (item->pszText);
+	    GetTextExtentPointW (dis->hDC, item->pszText, len, &txtsize);
+	    nbkc = GetSysColor ((dis->itemState & ODS_SELECTED) ?
+			        COLOR_HIGHLIGHT : COLOR_WINDOW);
+	    SetBkColor (dis->hDC, nbkc);
+	    ntxc = GetSysColor ((dis->itemState & ODS_SELECTED) ?
+			        COLOR_HIGHLIGHTTEXT : COLOR_WINDOWTEXT);
+	    SetTextColor (dis->hDC, ntxc);
+	    x = xbase + xioff;
+	    y = dis->rcItem.top +
+	        (dis->rcItem.bottom - dis->rcItem.top - txtsize.cy) / 2;
+	    rect.left = x;
+	    rect.right = x + txtsize.cx;
+	    rect.top = dis->rcItem.top + 1;
+	    rect.bottom = dis->rcItem.bottom - 1;
+	    TRACE("drawing item %d text, rect=(%d,%d)-(%d,%d)\n",
+		  dis->itemID, rect.left, rect.top, rect.right, rect.bottom);
+	    ExtTextOutW (dis->hDC, x, y, ETO_OPAQUE | ETO_CLIPPED,
+			 &rect, item->pszText, len, 0);
+	    if (dis->itemState & ODS_FOCUS) {
+		rect.top -= 1;
+		rect.bottom += 1;
+		rect.left -= 1;
+		rect.right += 1;
+		TRACE("drawing item %d focus after text, rect=(%d,%d)-(%d,%d)\n",
+		      dis->itemID, rect.left, rect.top, rect.right, rect.bottom);
+		DrawFocusRect (dis->hDC, &rect);
+	    }
+	}
+	break;
     default:
-        FIXME("unknown action hwnd=%08x, wparam=%08x, lparam=%08lx, action=%d\n",
-          hwnd, wParam, lParam, dis->itemAction);
+        FIXME("unknown action hwnd=%08x, wparam=%08x, lparam=%08lx, action=%d\n", 
+	      hwnd, wParam, lParam, dis->itemAction);
     }
 
@@ -735,17 +1569,22 @@
 
     if (infoPtr->hwndCombo)
-    DestroyWindow (infoPtr->hwndCombo);
+	DestroyWindow (infoPtr->hwndCombo);
+
+    if (infoPtr->edit) {
+	COMCTL32_Free (infoPtr->edit);
+	infoPtr->edit = 0;
+    }
 
     if (infoPtr->items) {
         CBE_ITEMDATA *this, *next;
 
-    this = infoPtr->items;
-    while (this) {
-        next = (CBE_ITEMDATA *)this->next;
-        if ((this->mask & CBEIF_TEXT) && this->pszText)
-            COMCTL32_Free (this->pszText);
-        COMCTL32_Free (this);
-        this = next;
-    }
+	this = infoPtr->items;
+	while (this) {
+	    next = (CBE_ITEMDATA *)this->next;
+	    if ((this->mask & CBEIF_TEXT) && this->pszText)
+	        COMCTL32_Free (this->pszText);
+	    COMCTL32_Free (this);
+	    this = next;
+	}
     }
 
@@ -773,5 +1612,5 @@
 
     TRACE("adjusted height hwnd=%08x, height=%d\n",
-      hwnd, mis->itemHeight);
+	  hwnd, mis->itemHeight);
 
     return 0;
@@ -785,8 +1624,12 @@
     RECT rect;
 
-    GetClientRect (hwnd, &rect);
+    GetWindowRect (hwnd, &rect);
+    TRACE("my rect (%d,%d)-(%d,%d)\n",
+	  rect.left, rect.top, rect.right, rect.bottom);
 
     MoveWindow (infoPtr->hwndCombo, 0, 0, rect.right -rect.left,
-          rect.bottom - rect.top, TRUE);
+		  rect.bottom - rect.top, TRUE);
+
+    COMBOEX_AdjustEditPos (infoPtr);
 
     return 0;
@@ -800,5 +1643,5 @@
     LRESULT ret;
     RECT cbx_wrect, cbx_crect, cb_wrect;
-    UINT width;
+    UINT width, height;
     WINDOWPOS *wp = (WINDOWPOS *)lParam;
 
@@ -810,19 +1653,453 @@
     /* width is winpos value + border width of comboex */
     width = wp->cx
-            + cbx_wrect.right-cbx_wrect.left
-            - (cbx_crect.right - cbx_crect.left);
+	    + (cbx_wrect.right-cbx_wrect.left) 
+            - (cbx_crect.right-cbx_crect.left); 
 
     TRACE("EX window=(%d,%d)-(%d,%d), client=(%d,%d)-(%d,%d)\n",
-      cbx_wrect.left, cbx_wrect.top, cbx_wrect.right, cbx_wrect.bottom,
-      cbx_crect.left, cbx_crect.top, cbx_crect.right, cbx_crect.bottom);
+	  cbx_wrect.left, cbx_wrect.top, cbx_wrect.right, cbx_wrect.bottom,
+	  cbx_crect.left, cbx_crect.top, cbx_crect.right, cbx_crect.bottom);
     TRACE("CB window=(%d,%d)-(%d,%d), EX setting=(0,0)-(%d,%d)\n",
-      cb_wrect.left, cb_wrect.top, cb_wrect.right, cb_wrect.bottom,
-      width, cb_wrect.bottom-cb_wrect.top);
-
-    SetWindowPos (infoPtr->hwndCombo, HWND_TOP, 0, 0,
-          width,
-          cb_wrect.bottom-cb_wrect.top,
-          SWP_NOACTIVATE);
-
+	  cb_wrect.left, cb_wrect.top, cb_wrect.right, cb_wrect.bottom,
+	  width, cb_wrect.bottom-cb_wrect.top);
+
+    if (width) SetWindowPos (infoPtr->hwndCombo, HWND_TOP, 0, 0,
+			     width,
+			     cb_wrect.bottom-cb_wrect.top,
+			     SWP_NOACTIVATE);
+
+    GetWindowRect (infoPtr->hwndCombo, &cb_wrect);
+
+    /* height is combo window height plus border width of comboex */
+    height =   (cb_wrect.bottom-cb_wrect.top)
+	     + (cbx_wrect.bottom-cbx_wrect.top)
+             - (cbx_crect.bottom-cbx_crect.top);
+    if (wp->cy < height) wp->cy = height;
+    if (infoPtr->hwndEdit) {
+	COMBOEX_AdjustEditPos (infoPtr);
+	InvalidateRect (infoPtr->hwndCombo, 0, TRUE);
+    }
+
+    return 0;
+}
+
+
+static LRESULT WINAPI
+COMBOEX_EditWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+    COMBOEX_INFO *infoPtr = (COMBOEX_INFO *)GetPropA (hwnd, (LPCSTR)(LONG) ComboExInfo);
+    NMCBEENDEDITA cbeend;
+    COLORREF nbkc, obkc;
+    HDC hDC;
+    RECT rect;
+    LRESULT lret;
+
+    TRACE("hwnd=%x msg=%x wparam=%x lParam=%lx, info_ptr=%p\n", 
+	  hwnd, uMsg, wParam, lParam, infoPtr);
+
+    if (!infoPtr) return 0;
+
+    switch (uMsg)
+    {
+
+    case WM_CHAR:
+	    /* handle (ignore) the return character */
+	    if (wParam == VK_RETURN) return 0;
+	    /* all other characters pass into the real Edit */
+	    return CallWindowProcA (infoPtr->prevEditWndProc, 
+				   hwnd, uMsg, wParam, lParam);
+
+    case WM_ERASEBKGND:
+	    /*
+	     * The following was determined by traces of the native 
+	     */
+            hDC = (HDC) wParam;
+	    nbkc = GetSysColor (COLOR_WINDOW);
+	    obkc = SetBkColor (hDC, nbkc);
+            GetClientRect (hwnd, &rect);
+	    TRACE("erasing (%d,%d)-(%d,%d)\n",
+		  rect.left, rect.top, rect.right, rect.bottom);
+	    ExtTextOutW (hDC, 0, 0, ETO_OPAQUE, &rect, 0, 0, 0);
+            SetBkColor (hDC, obkc);
+	    return CallWindowProcA (infoPtr->prevEditWndProc, 
+				   hwnd, uMsg, wParam, lParam);
+
+    case WM_KEYDOWN: {
+	    INT oldItem, selected;
+	    CBE_ITEMDATA *item;
+	    WCHAR edit_text[260];
+
+	    switch ((INT)wParam)
+	    {
+	    case VK_ESCAPE:
+		/* native version seems to do following for COMBOEX */
+		/*
+		 *   GetWindowTextA(Edit,&?, 0x104)             x
+		 *   CB_GETCURSEL to Combo rets -1              x
+		 *   WM_NOTIFY to COMBOEX parent (rebar)        x
+		 *     (CBEN_ENDEDIT{A|W} 
+		 *      fChanged = FALSE                        x
+		 *      inewSelection = -1                      x
+		 *      txt="www.hoho"                          x
+		 *      iWhy = 3                                x
+		 *   CB_GETCURSEL to Combo rets -1              x
+		 *   InvalidateRect(Combo, 0)                   x
+		 *   WM_SETTEXT to Edit                         x
+		 *   EM_SETSEL to Edit (0,0)                    x
+		 *   EM_SETSEL to Edit (0,-1)                   x
+		 *   RedrawWindow(Combo, 0, 0, 5)               x
+		 */
+		TRACE("special code for VK_ESCAPE\n");
+
+		GetWindowTextA (infoPtr->hwndEdit, cbeend.szText, 260);
+
+		infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG);
+		cbeend.fChanged = FALSE;
+		cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo,
+						     CB_GETCURSEL, 0, 0);
+		cbeend.iWhy = CBENF_ESCAPE;
+
+		if (COMBOEX_Notify (infoPtr, CBEN_ENDEDITA, 
+				    (NMHDR *)&cbeend, FALSE)) {
+		    /* abort the change */
+		    TRACE("Notify requested abort of change\n");
+		    return 0;
+		}
+		oldItem = SendMessageW (infoPtr->hwndCombo,CB_GETCURSEL, 0, 0);
+		InvalidateRect (infoPtr->hwndCombo, 0, 0);
+		if (!(item = COMBOEX_FindItem(infoPtr, oldItem))) {
+		    ERR("item %d not found. Problem!\n", oldItem);
+		    break;
+		}
+		  
+		COMBOEX_SetEditText (infoPtr, item);
+		RedrawWindow (infoPtr->hwndCombo, 0, 0, RDW_ERASE | 
+			      RDW_INVALIDATE);
+		break;
+
+	    case VK_RETURN:
+		/* native version seems to do following for COMBOEX */
+		/*
+		 *   GetWindowTextA(Edit,&?, 0x104)             x
+		 *   CB_GETCURSEL to Combo  rets -1             x
+		 *   CB_GETCOUNT to Combo  rets 0
+		 *   if >0 loop 
+		 *       CB_GETITEMDATA to match
+		 * *** above 3 lines simulated by FindItem      x  
+		 *   WM_NOTIFY to COMBOEX parent (rebar)        x
+		 *     (CBEN_ENDEDIT{A|W}                       x
+		 *        fChanged = TRUE (-1)                  x
+		 *        iNewSelection = -1 or selected        x
+		 *        txt=                                  x
+		 *        iWhy = 2 (CBENF_RETURN)               x
+		 *   CB_GETCURSEL to Combo  rets -1             x
+		 *   if -1 send CB_SETCURSEL to Combo -1        x
+		 *   InvalidateRect(Combo, 0, 0)                x
+		 *   SetFocus(Edit)                             x
+		 *   CallWindowProc(406615a8, Edit, 0x100, 0xd, 0x1c0001)
+		 */
+
+		TRACE("special code for VK_RETURN\n");
+
+		GetWindowTextW (infoPtr->hwndEdit, edit_text, 260);
+
+		infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG);
+		selected = SendMessageW (infoPtr->hwndCombo,
+					 CB_GETCURSEL, 0, 0);
+
+		if (selected != -1) {
+		    item = COMBOEX_FindItem (infoPtr, selected);
+		    TRACE("handling VK_RETURN, selected = %d, selected_text=%s\n",
+			  selected, debugstr_w(item->pszText));
+		    TRACE("handling VK_RETURN, edittext=%s\n",
+			  debugstr_w(edit_text));
+		    if (lstrcmpiW (item->pszText, edit_text)) {
+			/* strings not equal -- indicate edit has changed */
+			selected = -1;
+		    }
+		}
+
+		cbeend.iNewSelection = selected;
+		cbeend.fChanged = TRUE; 
+		cbeend.iWhy = CBENF_RETURN;
+		WideCharToMultiByte (CP_ACP, 0, edit_text, -1,
+				     cbeend.szText, sizeof(cbeend.szText),
+				     NULL, NULL);
+
+		if (COMBOEX_Notify (infoPtr, CBEN_ENDEDITA, 
+				    (NMHDR *)&cbeend, FALSE)) {
+		    /* abort the change, restore previous */
+		    TRACE("Notify requested abort of change\n");
+		    COMBOEX_SetEditText (infoPtr, infoPtr->edit);
+		    RedrawWindow (infoPtr->hwndCombo, 0, 0, RDW_ERASE | 
+				  RDW_INVALIDATE);
+		    return 0;
+		}
+		oldItem = SendMessageW (infoPtr->hwndCombo,CB_GETCURSEL, 0, 0);
+		if (oldItem != -1) {
+		    /* if something is selected, then deselect it */
+		    SendMessageW (infoPtr->hwndCombo, CB_SETCURSEL, 
+				  (WPARAM)-1, 0);
+		}
+		InvalidateRect (infoPtr->hwndCombo, 0, 0);
+		SetFocus(infoPtr->hwndEdit);
+		break;
+
+	    default:
+		return CallWindowProcA (infoPtr->prevEditWndProc,
+				       hwnd, uMsg, wParam, lParam);
+	    }
+	    return 0;
+            }
+
+    case WM_SETFOCUS:
+	    /* remember the focus to set state of icon */
+	    lret = CallWindowProcA (infoPtr->prevEditWndProc, 
+				   hwnd, uMsg, wParam, lParam);
+	    infoPtr->flags |= WCBE_EDITFOCUSED;
+	    return lret;
+
+    case WM_KILLFOCUS:
+	    /* 
+	     * do NOTIFY CBEN_ENDEDIT with CBENF_KILLFOCUS
+	     */
+	    infoPtr->flags &= ~WCBE_EDITFOCUSED;
+	    if (infoPtr->flags & WCBE_ACTEDIT) {
+		infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG);
+		cbeend.fChanged = FALSE;
+		cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo,
+						     CB_GETCURSEL, 0, 0);
+		cbeend.iWhy = CBENF_KILLFOCUS;
+
+		COMBOEX_Notify (infoPtr, CBEN_ENDEDITA, 
+				(NMHDR *)&cbeend, FALSE);
+	    }
+	    /* fall through */
+
+    default:
+	    return CallWindowProcA (infoPtr->prevEditWndProc, 
+				   hwnd, uMsg, wParam, lParam);
+    }
+    return 0;
+}
+
+
+static LRESULT WINAPI
+COMBOEX_ComboWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+    COMBOEX_INFO *infoPtr = (COMBOEX_INFO *)GetPropA (hwnd, (LPCSTR)(LONG) ComboExInfo);
+    NMCBEENDEDITA cbeend;
+    NMMOUSE nmmse;
+    COLORREF nbkc, obkc;
+    HDC hDC;
+    HWND focusedhwnd;
+    RECT rect;
+
+    TRACE("hwnd=%x msg=%x wparam=%x lParam=%lx, info_ptr=%p\n", 
+	  hwnd, uMsg, wParam, lParam, infoPtr);
+
+    if (!infoPtr) return 0;
+
+    switch (uMsg)
+    {
+
+    case CB_FINDSTRINGEXACT:
+	    return COMBOEX_FindStringExact (infoPtr, wParam, lParam);
+
+    case WM_DRAWITEM:
+	    /*
+	     * The only way this message should come is from the
+	     * child Listbox issuing the message. Flag this so
+	     * that ComboEx knows this is listbox.
+	     */
+	    ((DRAWITEMSTRUCT *)lParam)->itemState |= ODS_COMBOEXLBOX;
+	    return CallWindowProcA (infoPtr->prevComboWndProc, 
+				   hwnd, uMsg, wParam, lParam);
+
+    case WM_ERASEBKGND:
+	    /*
+	     * The following was determined by traces of the native 
+	     */
+            hDC = (HDC) wParam;
+	    nbkc = GetSysColor (COLOR_WINDOW);
+	    obkc = SetBkColor (hDC, nbkc);
+            GetClientRect (hwnd, &rect);
+	    TRACE("erasing (%d,%d)-(%d,%d)\n",
+		  rect.left, rect.top, rect.right, rect.bottom);
+	    ExtTextOutW (hDC, 0, 0, ETO_OPAQUE, &rect, 0, 0, 0);
+            SetBkColor (hDC, obkc);
+	    return CallWindowProcA (infoPtr->prevComboWndProc, 
+				   hwnd, uMsg, wParam, lParam);
+
+    case WM_SETCURSOR:
+	    /*
+	     *  WM_NOTIFY to comboex parent (rebar)
+	     *   with NM_SETCURSOR with extra words of 0,0,0,0,0x02010001
+	     *  CallWindowProc (previous)
+	     */
+	    nmmse.dwItemSpec = 0;
+	    nmmse.dwItemData = 0;
+	    nmmse.pt.x = 0;
+	    nmmse.pt.y = 0;
+	    nmmse.dwHitInfo = lParam;
+	    COMBOEX_Notify (infoPtr, NM_SETCURSOR, (NMHDR *)&nmmse, FALSE);
+	    return CallWindowProcA (infoPtr->prevComboWndProc, 
+				   hwnd, uMsg, wParam, lParam);
+
+    case WM_COMMAND:
+	    switch (HIWORD(wParam)) {
+
+	    case EN_UPDATE:
+		/* traces show that COMBOEX does not issue CBN_EDITUPDATE
+		 * on the EN_UPDATE
+		 */
+		return 0;
+
+	    case EN_KILLFOCUS:
+		/*
+		 * Native does:
+		 *
+		 *  GetFocus() retns AA
+		 *  GetWindowTextA(Edit)
+		 *  CB_GETCURSEL(Combo) (got -1)
+		 *  WM_NOTIFY(CBEN_ENDEDITA) with CBENF_KILLFOCUS
+		 *  CB_GETCURSEL(Combo) (got -1)
+		 *  InvalidateRect(Combo, 0, 0)
+		 *  WM_KILLFOCUS(Combo, AA)
+		 *  return 0;
+		 */
+		focusedhwnd = GetFocus();
+		if (infoPtr->flags & WCBE_ACTEDIT) {
+		    GetWindowTextA (infoPtr->hwndEdit, cbeend.szText, 260);
+		    cbeend.fChanged = (infoPtr->flags & WCBE_EDITCHG);
+		    cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo,
+							 CB_GETCURSEL, 0, 0);
+		    cbeend.iWhy = CBENF_KILLFOCUS;
+
+		    infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG);
+		    if (COMBOEX_Notify (infoPtr, CBEN_ENDEDITA, 
+					(NMHDR *)&cbeend, FALSE)) {
+			/* abort the change */
+			TRACE("Notify requested abort of change\n");
+			return 0;
+		    }
+		}
+		/* possible CB_GETCURSEL */
+		InvalidateRect (infoPtr->hwndCombo, 0, 0);
+		if (focusedhwnd)
+		    SendMessageW (infoPtr->hwndCombo, WM_KILLFOCUS,
+				  (WPARAM)focusedhwnd, 0); 
+		return 0;
+
+	    case EN_SETFOCUS: {
+		/* 
+		 * For EN_SETFOCUS this issues the same calls and messages
+		 *  as the native seems to do.
+		 *
+		 * for some cases however native does the following:
+		 *   (noticed after SetFocus during LBUTTONDOWN on
+		 *    on dropdown arrow)
+		 *  WM_GETTEXTLENGTH (Edit);
+		 *  WM_GETTEXT (Edit, len+1, str);
+		 *  EM_SETSEL (Edit, 0, 0);
+		 *  WM_GETTEXTLENGTH (Edit);
+		 *  WM_GETTEXT (Edit, len+1, str);
+		 *  EM_SETSEL (Edit, 0, len);
+		 *  WM_NOTIFY (parent, CBEN_BEGINEDIT)
+		 */
+		NMHDR hdr;
+
+		SendMessageW (infoPtr->hwndEdit, EM_SETSEL, 0, 0);
+		SendMessageW (infoPtr->hwndEdit, EM_SETSEL, 0, -1);
+		COMBOEX_Notify (infoPtr, CBEN_BEGINEDIT, &hdr, FALSE);
+		infoPtr->flags |= WCBE_ACTEDIT;
+		infoPtr->flags &= ~WCBE_EDITCHG; /* no change yet */
+		return 0;
+	        }
+
+	    case EN_CHANGE: {
+		/* 
+		 * For EN_CHANGE this issues the same calls and messages
+		 *  as the native seems to do.
+		 */
+		WCHAR edit_text[260];
+		WCHAR *lastwrk;
+		INT selected, cnt;
+		CBE_ITEMDATA *item;
+
+		selected = SendMessageW (infoPtr->hwndCombo,
+					 CB_GETCURSEL, 0, 0);
+
+		/* lstrlenA( lastworkingURL ) */
+
+		GetWindowTextW (infoPtr->hwndEdit, edit_text, 260);
+		if (selected == -1) {
+		    lastwrk = infoPtr->edit->pszText;
+		    cnt = lstrlenW (lastwrk);
+		    if (cnt >= 259) cnt = 259;
+		}
+		else {
+		    item = COMBOEX_FindItem (infoPtr, selected);
+		    cnt = lstrlenW (item->pszText);
+		    lastwrk = item->pszText;
+		    if (cnt >= 259) cnt = 259;
+		}
+
+		TRACE("handling EN_CHANGE, selected = %d, selected_text=%s\n",
+		    selected, debugstr_w(lastwrk));
+		TRACE("handling EN_CHANGE, edittext=%s\n",
+		      debugstr_w(edit_text));
+
+		/* lstrcmpiW is between lastworkingURL and GetWindowText */
+
+		if (lstrcmpiW (lastwrk, edit_text)) {
+		    /* strings not equal -- indicate edit has changed */
+		    infoPtr->flags |= WCBE_EDITCHG;
+		}
+		SendMessageW ( GetParent(infoPtr->hwndSelf), WM_COMMAND,
+			       MAKEWPARAM(GetDlgCtrlID (infoPtr->hwndSelf),
+					  CBN_EDITCHANGE),
+			       infoPtr->hwndSelf);
+		return 0;
+	        }
+
+	    case LBN_SELCHANGE:
+		/*
+		 * Therefore from traces there is no additional code here
+		 */
+
+		/*
+		 * Using native COMCTL32 gets the following:
+		 *  1 == SHDOCVW.DLL  issues call/message
+		 *  2 == COMCTL32.DLL  issues call/message
+		 *  3 == WINE  issues call/message
+		 *
+		 *
+		 * for LBN_SELCHANGE:
+		 *    1  CB_GETCURSEL(ComboEx)
+		 *    1  CB_GETDROPPEDSTATE(ComboEx)
+		 *    1  CallWindowProc( *2* for WM_COMMAND(LBN_SELCHANGE)
+		 *    2  CallWindowProc( *3* for WM_COMMAND(LBN_SELCHANGE)
+		 **   call CBRollUp( xxx, TRUE for LBN_SELCHANGE, TRUE)
+		 *    3  WM_COMMAND(ComboEx, CBN_SELENDOK)
+		 *      WM_USER+49(ComboLB, 1,0)  <=============!!!!!!!!!!!
+		 *    3  ShowWindow(ComboLB, SW_HIDE)
+		 *    3  RedrawWindow(Combo,  RDW_UPDATENOW)
+		 *    3  WM_COMMAND(ComboEX, CBN_CLOSEUP)
+		 **   end of CBRollUp
+		 *    3  WM_COMMAND(ComboEx, CBN_SELCHANGE)  (echo to parent)
+		 *    ?  LB_GETCURSEL              <==|
+		 *    ?  LB_GETTEXTLEN                |
+		 *    ?  LB_GETTEXT                   | Needs to be added to
+		 *    ?  WM_CTLCOLOREDIT(ComboEx)     | Combo processing
+		 *    ?  LB_GETITEMDATA               |
+		 *    ?  WM_DRAWITEM(ComboEx)      <==|
+		 */
+	    default:
+		break;
+	    }/* fall through */
+    default:
+	    return CallWindowProcA (infoPtr->prevComboWndProc, 
+				   hwnd, uMsg, wParam, lParam);
+    }
     return 0;
 }
@@ -838,99 +2115,131 @@
     switch (uMsg)
     {
-/*  case CBEM_DELETEITEM: */
-
-    case CBEM_GETCOMBOCONTROL:
-        return COMBOEX_GetComboControl (hwnd, wParam, lParam);
-
-    case CBEM_GETEDITCONTROL:
-        return COMBOEX_GetEditControl (hwnd, wParam, lParam);
-
-    case CBEM_GETEXTENDEDSTYLE:
-        return COMBOEX_GetExtendedStyle (hwnd, wParam, lParam);
-
-    case CBEM_GETIMAGELIST:
-        return COMBOEX_GetImageList (hwnd, wParam, lParam);
-
-/*  case CBEM_GETITEMA:
-    case CBEM_GETITEMW:
-    case CBEM_GETUNICODEFORMAT:
-    case CBEM_HASEDITCHANGED:
-*/
-
-    case CBEM_INSERTITEMA:
-        return COMBOEX_InsertItemA (hwnd, wParam, lParam);
-
-    case CBEM_INSERTITEMW:
-        return COMBOEX_InsertItemW (hwnd, wParam, lParam);
-
-    case CBEM_SETEXSTYLE:   /* FIXME: obsoleted, should be the same as: */
-    case CBEM_SETEXTENDEDSTYLE:
-        return COMBOEX_SetExtendedStyle (hwnd, wParam, lParam);
-
-    case CBEM_SETIMAGELIST:
-        return COMBOEX_SetImageList (hwnd, wParam, lParam);
-
-    case CBEM_SETITEMA:
-        return COMBOEX_SetItemA (hwnd, wParam, lParam);
-
-    case CBEM_SETITEMW:
-        return COMBOEX_SetItemW (hwnd, wParam, lParam);
-
-/*  case CBEM_SETUNICODEFORMAT:
-*/
-
-    case CB_DELETESTRING:
-    case CB_FINDSTRINGEXACT:
-    case CB_GETCOUNT:
-    case CB_GETCURSEL:
-    case CB_GETDROPPEDCONTROLRECT:
-    case CB_GETDROPPEDSTATE:
-    case CB_GETITEMDATA:
-    case CB_GETITEMHEIGHT:
-    case CB_GETLBTEXT:
-    case CB_GETLBTEXTLEN:
-    case CB_GETEXTENDEDUI:
-    case CB_LIMITTEXT:
-    case CB_RESETCONTENT:
-    case CB_SELECTSTRING:
-    case CB_SETCURSEL:
-    case CB_SETDROPPEDWIDTH:
-    case CB_SETEXTENDEDUI:
-    case CB_SETITEMDATA:
-    case CB_SHOWDROPDOWN:
-    case WM_SETTEXT:
-    case WM_GETTEXT:
-        return COMBOEX_Forward (hwnd, uMsg, wParam, lParam);
-
-    case CB_SETITEMHEIGHT:
-        return COMBOEX_SetItemHeight (hwnd, wParam, lParam);
-
-
-    case WM_CREATE:
-        return COMBOEX_Create (hwnd, wParam, lParam);
+        case CBEM_DELETEITEM:  /* maps to CB_DELETESTRING */
+	    return COMBOEX_DeleteItem (hwnd, wParam, lParam);
+
+	case CBEM_GETCOMBOCONTROL:
+	    return COMBOEX_GetComboControl (hwnd, wParam, lParam);
+
+	case CBEM_GETEDITCONTROL:
+	    return COMBOEX_GetEditControl (hwnd, wParam, lParam);
+
+	case CBEM_GETEXTENDEDSTYLE:
+	    return COMBOEX_GetExtendedStyle (hwnd, wParam, lParam);
+
+	case CBEM_GETIMAGELIST:
+	    return COMBOEX_GetImageList (hwnd, wParam, lParam);
+
+	case CBEM_GETITEMA:
+	    return COMBOEX_GetItemA (hwnd, wParam, lParam);
+
+	case CBEM_GETITEMW:
+	    return COMBOEX_GetItemW (hwnd, wParam, lParam);
+
+	case CBEM_GETUNICODEFORMAT:
+	    return COMBOEX_GetUnicodeFormat (hwnd, wParam, lParam);
+
+	case CBEM_HASEDITCHANGED:
+	    return COMBOEX_HasEditChanged (hwnd, wParam, lParam);
+
+	case CBEM_INSERTITEMA:
+	    return COMBOEX_InsertItemA (hwnd, wParam, lParam);
+
+	case CBEM_INSERTITEMW:
+	    return COMBOEX_InsertItemW (hwnd, wParam, lParam);
+
+	case CBEM_SETEXSTYLE:	/* FIXME: obsoleted, should be the same as: */
+	case CBEM_SETEXTENDEDSTYLE:
+	    return COMBOEX_SetExtendedStyle (hwnd, wParam, lParam);
+
+	case CBEM_SETIMAGELIST:
+	    return COMBOEX_SetImageList (hwnd, wParam, lParam);
+
+	case CBEM_SETITEMA:
+	    return COMBOEX_SetItemA (hwnd, wParam, lParam);
+
+	case CBEM_SETITEMW:
+	    return COMBOEX_SetItemW (hwnd, wParam, lParam);
+
+	case CBEM_SETUNICODEFORMAT:
+	    return COMBOEX_SetUnicodeFormat (hwnd, wParam, lParam);
+
+
+/*   Combo messages we are not sure if we need to process or just forward */
+	case CB_GETDROPPEDCONTROLRECT:
+	case CB_GETITEMDATA:
+	case CB_GETITEMHEIGHT:
+	case CB_GETLBTEXT:
+	case CB_GETLBTEXTLEN:
+	case CB_GETEXTENDEDUI:
+	case CB_LIMITTEXT:
+	case CB_RESETCONTENT:
+	case CB_SELECTSTRING:
+	case CB_SETITEMDATA:
+	case WM_SETTEXT:
+	case WM_GETTEXT:
+	    FIXME("(0x%x 0x%x 0x%lx): possible missing fucntion\n", 
+		  uMsg, wParam, lParam);
+	    return COMBOEX_Forward (hwnd, uMsg, wParam, lParam);
+
+/*   Combo messages OK to just forward to the regular COMBO */
+	case CB_GETCOUNT:        
+	case CB_GETCURSEL:
+	case CB_GETDROPPEDSTATE:
+        case CB_SETDROPPEDWIDTH:
+        case CB_SETEXTENDEDUI:
+        case CB_SHOWDROPDOWN:
+	    return COMBOEX_Forward (hwnd, uMsg, wParam, lParam);
+
+/*   Combo messages we need to process specially */
+        case CB_FINDSTRINGEXACT:
+	    return COMBOEX_FindStringExact (COMBOEX_GetInfoPtr (hwnd), 
+					    wParam, lParam);
+
+	case CB_SETCURSEL:
+	    return COMBOEX_SetCursel (hwnd, wParam, lParam);
+
+	case CB_SETITEMHEIGHT:
+	    return COMBOEX_SetItemHeight (hwnd, wParam, lParam);
+
+
+
+/*   Window messages passed to parent */
+	case WM_COMMAND:
+	    return COMBOEX_Command (hwnd, wParam, lParam);
+
+	case WM_NOTIFY:
+	    return SendMessageA (GetParent (hwnd), uMsg, wParam, lParam);
+
+
+/*   Window messages we need to process */
+	case WM_CREATE:
+	    return COMBOEX_Create (hwnd, wParam, lParam);
+
+        case WM_DELETEITEM:
+	    return COMBOEX_WM_DeleteItem (hwnd, wParam, lParam);
 
         case WM_DRAWITEM:
             return COMBOEX_DrawItem (hwnd, wParam, lParam);
 
-    case WM_DESTROY:
-        return COMBOEX_Destroy (hwnd, wParam, lParam);
+	case WM_DESTROY:
+	    return COMBOEX_Destroy (hwnd, wParam, lParam);
 
         case WM_MEASUREITEM:
             return COMBOEX_MeasureItem (hwnd, wParam, lParam);
 
-    case WM_SIZE:
-        return COMBOEX_Size (hwnd, wParam, lParam);
+	case WM_SIZE:
+	    return COMBOEX_Size (hwnd, wParam, lParam);
 
         case WM_WINDOWPOSCHANGING:
-        return COMBOEX_WindowPosChanging (hwnd, wParam, lParam);
-
-    default:
-        if (uMsg >= WM_USER)
-        ERR("unknown msg %04x wp=%08x lp=%08lx\n",
-             uMsg, wParam, lParam);
+	    return COMBOEX_WindowPosChanging (hwnd, wParam, lParam);
+
+	default:
+	    if (uMsg >= WM_USER)
+		ERR("unknown msg %04x wp=%08x lp=%08lx\n",
+		     uMsg, wParam, lParam);
 #ifdef __WIN32OS2__
             return defComCtl32ProcA (hwnd, uMsg, wParam, lParam);
 #else
-        return DefWindowProcA (hwnd, uMsg, wParam, lParam);
+            return DefWindowProcA (hwnd, uMsg, wParam, lParam);
 #endif
     }
@@ -952,6 +2261,8 @@
     wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
     wndClass.lpszClassName = WC_COMBOBOXEXA;
-
+ 
     RegisterClassA (&wndClass);
+
+    ComboExInfo = GlobalAddAtomA("CC32SubclassInfo");
 }
 
Index: trunk/src/comctl32/comctl32.c
===================================================================
--- trunk/src/comctl32/comctl32.c	(revision 5416)
+++ trunk/src/comctl32/comctl32.c	(revision 5416)
@@ -0,0 +1,1221 @@
+/*		
+ * Common controls functions
+ *
+ * Copyright 1997 Dimitrie O. Paun
+ * Copyright 1998,2000 Eric Kohl
+ *
+ */
+
+#ifdef __WIN32OS2__
+#include <odin.h>
+#endif
+
+#include <string.h>
+#include "winbase.h"
+#include "heap.h"
+#include "commctrl.h"
+#include "debugtools.h"
+#include "winerror.h"
+#include "shlwapi.h"
+#include "comctl32.h"
+
+DEFAULT_DEBUG_CHANNEL(commctrl);
+
+#ifndef __WIN32OS2__
+extern void ANIMATE_Register(void);
+extern void ANIMATE_Unregister(void);
+extern void COMBOEX_Register(void);
+extern void COMBOEX_Unregister(void);
+extern void DATETIME_Register(void);
+extern void DATETIME_Unregister(void);
+extern void FLATSB_Register(void);
+extern void FLATSB_Unregister(void);
+extern void HEADER_Register(void);
+extern void HEADER_Unregister(void);
+extern void HOTKEY_Register(void);
+extern void HOTKEY_Unregister(void);
+extern void IPADDRESS_Register(void);
+extern void IPADDRESS_Unregister(void);
+extern void LISTVIEW_Register(void);
+extern void LISTVIEW_Unregister(void);
+extern void MONTHCAL_Register(void);
+extern void MONTHCAL_Unregister(void);
+extern void NATIVEFONT_Register(void);
+extern void NATIVEFONT_Unregister(void);
+extern void PAGER_Register(void);
+extern void PAGER_Unregister(void);
+extern void PROGRESS_Register(void);
+extern void PROGRESS_Unregister(void);
+extern void REBAR_Register(void);
+extern void REBAR_Unregister(void);
+extern void STATUS_Register(void);
+extern void STATUS_Unregister(void);
+extern void TAB_Register(void);
+extern void TAB_Unregister(void);
+extern void TOOLBAR_Register(void);
+extern void TOOLBAR_Unregister(void);
+extern void TOOLTIPS_Register(void);
+extern void TOOLTIPS_Unregister(void);
+extern void TRACKBAR_Register(void);
+extern void TRACKBAR_Unregister(void);
+extern void TREEVIEW_Register(void);
+extern void TREEVIEW_Unregister(void);
+extern void UPDOWN_Register(void);
+extern void UPDOWN_Unregister(void);
+#endif
+
+HANDLE COMCTL32_hHeap = (HANDLE)NULL;
+LPSTR    COMCTL32_aSubclass = (LPSTR)NULL;
+HMODULE COMCTL32_hModule = 0;
+LANGID  COMCTL32_uiLang = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL);
+HBRUSH  COMCTL32_hPattern55AABrush = (HANDLE)NULL;
+
+static HBITMAP COMCTL32_hPattern55AABitmap = (HANDLE)NULL;
+
+static const WORD wPattern55AA[] =
+{
+    0x5555, 0xaaaa, 0x5555, 0xaaaa,
+    0x5555, 0xaaaa, 0x5555, 0xaaaa
+};
+
+
+/***********************************************************************
+ * COMCTL32_LibMain [Internal] Initializes the internal 'COMCTL32.DLL'.
+ *
+ * PARAMS
+ *     hinstDLL    [I] handle to the 'dlls' instance
+ *     fdwReason   [I]
+ *     lpvReserved [I] reserverd, must be NULL
+ *
+ * RETURNS
+ *     Success: TRUE
+ *     Failure: FALSE
+ */
+
+BOOL WINAPI
+COMCTL32_LibMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+{
+    TRACE("%x,%lx,%p\n", hinstDLL, fdwReason, lpvReserved);
+
+    switch (fdwReason) {
+	case DLL_PROCESS_ATTACH:
+            COMCTL32_hModule = (HMODULE)hinstDLL;
+
+            /* create private heap */
+            COMCTL32_hHeap = HeapCreate (0, 0x10000, 0);
+            TRACE("Heap created: 0x%x\n", COMCTL32_hHeap);
+
+            /* add global subclassing atom (used by 'tooltip' and 'updown') */
+            COMCTL32_aSubclass = (LPSTR)(DWORD)GlobalAddAtomA ("CC32SubclassInfo");
+            TRACE("Subclassing atom added: %p\n", COMCTL32_aSubclass);
+
+            /* create local pattern brush */
+            COMCTL32_hPattern55AABitmap = CreateBitmap (8, 8, 1, 1, wPattern55AA);
+            COMCTL32_hPattern55AABrush = CreatePatternBrush (COMCTL32_hPattern55AABitmap);
+
+            /* register all Win95 common control classes */
+            ANIMATE_Register ();
+            FLATSB_Register ();
+            HEADER_Register ();
+            HOTKEY_Register ();
+            LISTVIEW_Register ();
+            PROGRESS_Register ();
+            STATUS_Register ();
+            TAB_Register ();
+            TOOLBAR_Register ();
+            TOOLTIPS_Register ();
+            TRACKBAR_Register ();
+            TREEVIEW_Register ();
+            UPDOWN_Register ();
+            break;
+
+	case DLL_PROCESS_DETACH:
+            /* unregister all common control classes */
+            ANIMATE_Unregister ();
+            COMBOEX_Unregister ();
+            DATETIME_Unregister ();
+            FLATSB_Unregister ();
+            HEADER_Unregister ();
+            HOTKEY_Unregister ();
+            IPADDRESS_Unregister ();
+            LISTVIEW_Unregister ();
+            MONTHCAL_Unregister ();
+            NATIVEFONT_Unregister ();
+            PAGER_Unregister ();
+            PROGRESS_Unregister ();
+            REBAR_Unregister ();
+            STATUS_Unregister ();
+            TAB_Unregister ();
+            TOOLBAR_Unregister ();
+            TOOLTIPS_Unregister ();
+            TRACKBAR_Unregister ();
+            TREEVIEW_Unregister ();
+            UPDOWN_Unregister ();
+
+            /* delete local pattern brush */
+            DeleteObject (COMCTL32_hPattern55AABrush);
+            COMCTL32_hPattern55AABrush = (HANDLE)NULL;
+            DeleteObject (COMCTL32_hPattern55AABitmap);
+            COMCTL32_hPattern55AABitmap = (HANDLE)NULL;
+
+            /* delete global subclassing atom */
+            GlobalDeleteAtom (LOWORD(COMCTL32_aSubclass));
+            TRACE("Subclassing atom deleted: %p\n", COMCTL32_aSubclass);
+            COMCTL32_aSubclass = (LPSTR)NULL;
+
+            /* destroy private heap */
+            HeapDestroy (COMCTL32_hHeap);
+            TRACE("Heap destroyed: 0x%x\n", COMCTL32_hHeap);
+            COMCTL32_hHeap = (HANDLE)NULL;
+            break;
+    }
+
+    return TRUE;
+}
+
+
+/***********************************************************************
+ * MenuHelp [COMCTL32.2]
+ *
+ * PARAMS
+ *     uMsg       [I] message (WM_MENUSELECT) (see NOTES)
+ *     wParam     [I] wParam of the message uMsg
+ *     lParam     [I] lParam of the message uMsg
+ *     hMainMenu  [I] handle to the application's main menu
+ *     hInst      [I] handle to the module that contains string resources
+ *     hwndStatus [I] handle to the status bar window
+ *     lpwIDs     [I] pointer to an array of integers (see NOTES)
+ *
+ * RETURNS
+ *     No return value
+ *
+ * NOTES
+ *     The official documentation is incomplete!
+ *     This is the correct documentation:
+ *
+ *     uMsg:
+ *     MenuHelp() does NOT handle WM_COMMAND messages! It only handles
+ *     WM_MENUSELECT messages.
+ *
+ *     lpwIDs:
+ *     (will be written ...)
+ */
+
+VOID WINAPI
+MenuHelp (UINT uMsg, WPARAM wParam, LPARAM lParam, HMENU hMainMenu,
+	  HINSTANCE hInst, HWND hwndStatus, LPUINT lpwIDs)
+{
+    UINT uMenuID = 0;
+
+    if (!IsWindow (hwndStatus))
+	return;
+
+    switch (uMsg) {
+	case WM_MENUSELECT:
+	    TRACE("WM_MENUSELECT wParam=0x%X lParam=0x%lX\n",
+		   wParam, lParam);
+
+            if ((HIWORD(wParam) == 0xFFFF) && (lParam == 0)) {
+                /* menu was closed */
+		TRACE("menu was closed!\n");
+                SendMessageA (hwndStatus, SB_SIMPLE, FALSE, 0);
+            }
+	    else {
+		/* menu item was selected */
+		if (HIWORD(wParam) & MF_POPUP)
+		    uMenuID = (UINT)*(lpwIDs+1);
+		else
+		    uMenuID = (UINT)LOWORD(wParam);
+		TRACE("uMenuID = %u\n", uMenuID);
+
+		if (uMenuID) {
+		    CHAR szText[256];
+
+		    if (!LoadStringA (hInst, uMenuID, szText, 256))
+			szText[0] = '\0';
+
+		    SendMessageA (hwndStatus, SB_SETTEXTA,
+				    255 | SBT_NOBORDERS, (LPARAM)szText);
+		    SendMessageA (hwndStatus, SB_SIMPLE, TRUE, 0);
+		}
+	    }
+	    break;
+
+        case WM_COMMAND :
+	    TRACE("WM_COMMAND wParam=0x%X lParam=0x%lX\n",
+		   wParam, lParam);
+	    /* WM_COMMAND is not invalid since it is documented
+	     * in the windows api reference. So don't output
+             * any FIXME for WM_COMMAND
+             */
+	    WARN("We don't care about the WM_COMMAND\n");
+	    break;
+
+	default:
+	    FIXME("Invalid Message 0x%x!\n", uMsg);
+	    break;
+    }
+}
+
+
+/***********************************************************************
+ * ShowHideMenuCtl [COMCTL32.3] 
+ *
+ * Shows or hides controls and updates the corresponding menu item.
+ *
+ * PARAMS
+ *     hwnd   [I] handle to the client window.
+ *     uFlags [I] menu command id.
+ *     lpInfo [I] pointer to an array of integers. (See NOTES.)
+ *
+ * RETURNS
+ *     Success: TRUE
+ *     Failure: FALSE
+ *
+ * NOTES
+ *     The official documentation is incomplete!
+ *     This is the correct documentation:
+ *
+ *     hwnd
+ *     Handle to the window that contains the menu and controls.
+ *
+ *     uFlags
+ *     Identifier of the menu item to receive or loose a check mark.
+ *
+ *     lpInfo
+ *     The array of integers contains pairs of values. BOTH values of
+ *     the first pair must be the handles to the application's main menu.
+ *     Each subsequent pair consists of a menu id and control id.
+ */
+
+BOOL WINAPI
+ShowHideMenuCtl (HWND hwnd, UINT uFlags, LPINT lpInfo)
+{
+    LPINT lpMenuId;
+
+    TRACE("%x, %x, %p\n", hwnd, uFlags, lpInfo);
+
+    if (lpInfo == NULL)
+	return FALSE;
+
+    if (!(lpInfo[0]) || !(lpInfo[1]))
+	return FALSE;
+
+    /* search for control */
+    lpMenuId = &lpInfo[2];
+    while (*lpMenuId != uFlags)
+	lpMenuId += 2;
+
+    if (GetMenuState (lpInfo[1], uFlags, MF_BYCOMMAND) & MFS_CHECKED) {
+	/* uncheck menu item */
+	CheckMenuItem (lpInfo[0], *lpMenuId, MF_BYCOMMAND | MF_UNCHECKED);
+
+	/* hide control */
+	lpMenuId++;
+	SetWindowPos (GetDlgItem (hwnd, *lpMenuId), 0, 0, 0, 0, 0,
+			SWP_HIDEWINDOW);
+    }
+    else {
+	/* check menu item */
+	CheckMenuItem (lpInfo[0], *lpMenuId, MF_BYCOMMAND | MF_CHECKED);
+
+	/* show control */
+	lpMenuId++;
+	SetWindowPos (GetDlgItem (hwnd, *lpMenuId), 0, 0, 0, 0, 0,
+			SWP_SHOWWINDOW);
+    }
+
+    return TRUE;
+}
+
+
+/***********************************************************************
+ * GetEffectiveClientRect [COMCTL32.4]
+ *
+ * PARAMS
+ *     hwnd   [I] handle to the client window.
+ *     lpRect [O] pointer to the rectangle of the client window
+ *     lpInfo [I] pointer to an array of integers (see NOTES)
+ *
+ * RETURNS
+ *     No return value.
+ *
+ * NOTES
+ *     The official documentation is incomplete!
+ *     This is the correct documentation:
+ *
+ *     lpInfo
+ *     (will be written...)
+ */
+
+VOID WINAPI
+GetEffectiveClientRect (HWND hwnd, LPRECT lpRect, LPINT lpInfo)
+{
+    RECT rcCtrl;
+    INT  *lpRun;
+    HWND hwndCtrl;
+
+    TRACE("(0x%08lx 0x%08lx 0x%08lx)\n",
+	   (DWORD)hwnd, (DWORD)lpRect, (DWORD)lpInfo);
+
+    GetClientRect (hwnd, lpRect);
+    lpRun = lpInfo;
+
+    do {
+	lpRun += 2;
+	if (*lpRun == 0)
+	    return;
+	lpRun++;
+	hwndCtrl = GetDlgItem (hwnd, *lpRun);
+	if (GetWindowLongA (hwndCtrl, GWL_STYLE) & WS_VISIBLE) {
+	    TRACE("control id 0x%x\n", *lpRun);
+	    GetWindowRect (hwndCtrl, &rcCtrl);
+	    MapWindowPoints ((HWND)0, hwnd, (LPPOINT)&rcCtrl, 2);
+	    SubtractRect (lpRect, lpRect, &rcCtrl);
+	}
+	lpRun++;
+    } while (*lpRun);
+}
+
+
+/***********************************************************************
+ * DrawStatusTextA [COMCTL32.5][COMCTL32.27]
+ *
+ * Draws text with borders, like in a status bar.
+ *
+ * PARAMS
+ *     hdc   [I] handle to the window's display context
+ *     lprc  [I] pointer to a rectangle
+ *     text  [I] pointer to the text
+ *     style [I] drawing style
+ *
+ * RETURNS
+ *     No return value.
+ *
+ * NOTES
+ *     The style variable can have one of the following values:
+ *     (will be written ...)
+ */
+
+VOID WINAPI
+DrawStatusTextA (HDC hdc, LPRECT lprc, LPCSTR text, UINT style)
+{
+    RECT r = *lprc;
+    UINT border = BDR_SUNKENOUTER;
+
+    if (style & SBT_POPOUT)
+      border = BDR_RAISEDOUTER;
+    else if (style & SBT_NOBORDERS)
+      border = 0;
+
+    DrawEdge (hdc, &r, border, BF_RECT|BF_ADJUST|BF_MIDDLE);
+
+    /* now draw text */
+    if (text) {
+      int oldbkmode = SetBkMode (hdc, TRANSPARENT);
+      r.left += 3;
+      DrawTextA (hdc, text, lstrlenA(text),
+		   &r, DT_LEFT|DT_VCENTER|DT_SINGLELINE);  
+      if (oldbkmode != TRANSPARENT)
+	SetBkMode(hdc, oldbkmode);
+    }
+}
+
+
+/***********************************************************************
+ * DrawStatusTextW [COMCTL32.28]
+ *
+ * Draws text with borders, like in a status bar.
+ *
+ * PARAMS
+ *     hdc   [I] handle to the window's display context
+ *     lprc  [I] pointer to a rectangle
+ *     text  [I] pointer to the text
+ *     style [I] drawing style
+ *
+ * RETURNS
+ *     No return value.
+ */
+
+VOID WINAPI
+DrawStatusTextW (HDC hdc, LPRECT lprc, LPCWSTR text, UINT style)
+{
+    LPSTR p = HEAP_strdupWtoA (GetProcessHeap (), 0, text);
+    DrawStatusTextA (hdc, lprc, p, style);
+    HeapFree (GetProcessHeap (), 0, p );
+}
+
+
+/***********************************************************************
+ * CreateStatusWindowA [COMCTL32.6][COMCTL32.21]
+ *
+ * Creates a status bar
+ *
+ * PARAMS
+ *     style  [I] window style
+ *     text   [I] pointer to the window text
+ *     parent [I] handle to the parent window
+ *     wid    [I] control id of the status bar
+ *
+ * RETURNS
+ *     Success: handle to the status window
+ *     Failure: 0
+ */
+
+HWND WINAPI
+CreateStatusWindowA (INT style, LPCSTR text, HWND parent, UINT wid)
+{
+    return CreateWindowA(STATUSCLASSNAMEA, text, style, 
+			   CW_USEDEFAULT, CW_USEDEFAULT,
+			   CW_USEDEFAULT, CW_USEDEFAULT, 
+			   parent, wid, 0, 0);
+}
+
+
+/***********************************************************************
+ * CreateStatusWindowW [COMCTL32.22] Creates a status bar control
+ *
+ * PARAMS
+ *     style  [I] window style
+ *     text   [I] pointer to the window text
+ *     parent [I] handle to the parent window
+ *     wid    [I] control id of the status bar
+ *
+ * RETURNS
+ *     Success: handle to the status window
+ *     Failure: 0
+ */
+
+HWND WINAPI
+CreateStatusWindowW (INT style, LPCWSTR text, HWND parent, UINT wid)
+{
+    return CreateWindowW(STATUSCLASSNAMEW, text, style,
+			   CW_USEDEFAULT, CW_USEDEFAULT,
+			   CW_USEDEFAULT, CW_USEDEFAULT,
+			   parent, wid, 0, 0);
+}
+
+
+/***********************************************************************
+ * CreateUpDownControl [COMCTL32.16] Creates an up-down control
+ *
+ * PARAMS
+ *     style  [I] window styles
+ *     x      [I] horizontal position of the control
+ *     y      [I] vertical position of the control
+ *     cx     [I] with of the control
+ *     cy     [I] height of the control
+ *     parent [I] handle to the parent window
+ *     id     [I] the control's identifier
+ *     inst   [I] handle to the application's module instance
+ *     buddy  [I] handle to the buddy window, can be NULL
+ *     maxVal [I] upper limit of the control
+ *     minVal [I] lower limit of the control
+ *     curVal [I] current value of the control
+ *
+ * RETURNS
+ *     Success: handle to the updown control
+ *     Failure: 0
+ */
+
+HWND WINAPI
+CreateUpDownControl (DWORD style, INT x, INT y, INT cx, INT cy,
+		     HWND parent, INT id, HINSTANCE inst,
+		     HWND buddy, INT maxVal, INT minVal, INT curVal)
+{
+    HWND hUD =
+	CreateWindowA (UPDOWN_CLASSA, 0, style, x, y, cx, cy,
+			 parent, id, inst, 0);
+    if (hUD) {
+	SendMessageA (hUD, UDM_SETBUDDY, buddy, 0);
+	SendMessageA (hUD, UDM_SETRANGE, 0, MAKELONG(maxVal, minVal));
+	SendMessageA (hUD, UDM_SETPOS, 0, MAKELONG(curVal, 0));     
+    }
+
+    return hUD;
+}
+
+
+/***********************************************************************
+ * InitCommonControls [COMCTL32.17]
+ *
+ * Registers the common controls.
+ *
+ * PARAMS
+ *     No parameters.
+ *
+ * RETURNS
+ *     No return values.
+ *
+ * NOTES
+ *     This function is just a dummy.
+ *     The Win95 controls are registered at the DLL's initialization.
+ *     To register other controls InitCommonControlsEx() must be used.
+ */
+
+VOID WINAPI
+InitCommonControls (void)
+{
+}
+
+
+/***********************************************************************
+ * InitCommonControlsEx [COMCTL32.81]
+ *
+ * Registers the common controls.
+ *
+ * PARAMS
+ *     lpInitCtrls [I] pointer to an INITCOMMONCONTROLS structure.
+ *
+ * RETURNS
+ *     Success: TRUE
+ *     Failure: FALSE
+ *
+ * NOTES
+ *     Only the additional common controls are registered by this function.
+ *     The Win95 controls are registered at the DLL's initialization.
+ */
+
+BOOL WINAPI
+InitCommonControlsEx (LPINITCOMMONCONTROLSEX lpInitCtrls)
+{
+    INT cCount;
+    DWORD dwMask;
+
+    if (!lpInitCtrls)
+	return FALSE;
+    if (lpInitCtrls->dwSize != sizeof(INITCOMMONCONTROLSEX))
+	return FALSE;
+
+    TRACE("(0x%08lx)\n", lpInitCtrls->dwICC);
+
+    for (cCount = 0; cCount < 32; cCount++) {
+	dwMask = 1 << cCount;
+	if (!(lpInitCtrls->dwICC & dwMask))
+	    continue;
+
+	switch (lpInitCtrls->dwICC & dwMask) {
+	    /* dummy initialization */
+	    case ICC_ANIMATE_CLASS:
+	    case ICC_BAR_CLASSES:
+	    case ICC_LISTVIEW_CLASSES:
+	    case ICC_TREEVIEW_CLASSES:
+	    case ICC_TAB_CLASSES:
+	    case ICC_UPDOWN_CLASS:
+	    case ICC_PROGRESS_CLASS:
+	    case ICC_HOTKEY_CLASS:
+		break;
+
+	    /* advanced classes - not included in Win95 */
+	    case ICC_DATE_CLASSES:
+		MONTHCAL_Register ();
+		DATETIME_Register ();
+		break;
+
+	    case ICC_USEREX_CLASSES:
+		COMBOEX_Register ();
+		break;
+
+	    case ICC_COOL_CLASSES:
+		REBAR_Register ();
+		break;
+
+	    case ICC_INTERNET_CLASSES:
+		IPADDRESS_Register ();
+		break;
+
+	    case ICC_PAGESCROLLER_CLASS:
+		PAGER_Register ();
+		break;
+
+	    case ICC_NATIVEFNTCTL_CLASS:
+		NATIVEFONT_Register ();
+		break;
+
+	    default:
+		FIXME("Unknown class! dwICC=0x%lX\n", dwMask);
+		break;
+	}
+    }
+
+    return TRUE;
+}
+
+
+/***********************************************************************
+ * CreateToolbarEx [COMCTL32.32] Creates a tool bar window
+ *
+ * PARAMS
+ *     hwnd
+ *     style
+ *     wID
+ *     nBitmaps
+ *     hBMInst
+ *     wBMID
+ *     lpButtons
+ *     iNumButtons
+ *     dxButton
+ *     dyButton
+ *     dxBitmap
+ *     dyBitmap
+ *     uStructSize
+ *
+ * RETURNS
+ *     Success: handle to the tool bar control
+ *     Failure: 0
+ */
+
+HWND WINAPI
+CreateToolbarEx (HWND hwnd, DWORD style, UINT wID, INT nBitmaps,
+                 HINSTANCE hBMInst, UINT wBMID, LPCTBBUTTON lpButtons,
+                 INT iNumButtons, INT dxButton, INT dyButton,
+                 INT dxBitmap, INT dyBitmap, UINT uStructSize)
+{
+    HWND hwndTB;
+
+    /* If not position is specified then put it at the top */
+    if ((style & CCS_BOTTOM) == 0) {
+      style|=CCS_TOP;
+    }
+
+    hwndTB =
+        CreateWindowExA (0, TOOLBARCLASSNAMEA, "", style|WS_CHILD, 0, 0, 0, 0,
+			   hwnd, (HMENU)wID, 0, NULL);
+    if(hwndTB) {
+	TBADDBITMAP tbab;
+
+        SendMessageA (hwndTB, TB_BUTTONSTRUCTSIZE,
+			(WPARAM)uStructSize, 0);
+
+       /* set bitmap and button size */
+       /*If CreateToolbarEx receives 0, windows sets default values*/
+       if (dxBitmap <= 0)
+           dxBitmap = 16;
+       if (dyBitmap <= 0)
+           dyBitmap = 15;
+       SendMessageA (hwndTB, TB_SETBITMAPSIZE, 0,
+                       MAKELPARAM((WORD)dxBitmap, (WORD)dyBitmap));
+
+       if (dxButton <= 0)
+           dxButton = 24;
+       if (dyButton <= 0)
+           dyButton = 22;
+       SendMessageA (hwndTB, TB_SETBUTTONSIZE, 0,
+                       MAKELPARAM((WORD)dxButton, (WORD)dyButton));
+
+
+	/* add bitmaps */
+	if (nBitmaps > 0)
+	{
+	tbab.hInst = hBMInst;
+	tbab.nID   = wBMID;
+
+	SendMessageA (hwndTB, TB_ADDBITMAP,
+			(WPARAM)nBitmaps, (LPARAM)&tbab);
+	}
+	/* add buttons */
+	if(iNumButtons > 0)
+	SendMessageA (hwndTB, TB_ADDBUTTONSA,
+			(WPARAM)iNumButtons, (LPARAM)lpButtons);
+    }
+
+    return hwndTB;
+}
+
+
+/***********************************************************************
+ * CreateMappedBitmap [COMCTL32.8]
+ *
+ * PARAMS
+ *     hInstance  [I]
+ *     idBitmap   [I]
+ *     wFlags     [I]
+ *     lpColorMap [I]
+ *     iNumMaps   [I]
+ *
+ * RETURNS
+ *     Success: handle to the new bitmap
+ *     Failure: 0
+ */
+
+HBITMAP WINAPI
+CreateMappedBitmap (HINSTANCE hInstance, INT idBitmap, UINT wFlags,
+		    LPCOLORMAP lpColorMap, INT iNumMaps)
+{
+    HGLOBAL hglb;
+    HRSRC hRsrc;
+    LPBITMAPINFOHEADER lpBitmap, lpBitmapInfo;
+    UINT nSize, nColorTableSize;
+    RGBQUAD *pColorTable;
+    INT iColor, i, iMaps, nWidth, nHeight;
+    HDC hdcScreen;
+    HBITMAP hbm;
+    LPCOLORMAP sysColorMap;
+    COLORREF cRef;
+    COLORMAP internalColorMap[4] =
+	{{0x000000, 0}, {0x808080, 0}, {0xC0C0C0, 0}, {0xFFFFFF, 0}};
+
+    /* initialize pointer to colortable and default color table */
+    if (lpColorMap) {
+	iMaps = iNumMaps;
+	sysColorMap = lpColorMap;
+    }
+    else {
+	internalColorMap[0].to = GetSysColor (COLOR_BTNTEXT);
+	internalColorMap[1].to = GetSysColor (COLOR_BTNSHADOW);
+	internalColorMap[2].to = GetSysColor (COLOR_BTNFACE);
+	internalColorMap[3].to = GetSysColor (COLOR_BTNHIGHLIGHT);
+	iMaps = 4;
+	sysColorMap = (LPCOLORMAP)internalColorMap;
+    }
+
+    hRsrc = FindResourceA (hInstance, (LPSTR)idBitmap, RT_BITMAPA);
+    if (hRsrc == 0)
+	return 0;
+    hglb = LoadResource (hInstance, hRsrc);
+    if (hglb == 0)
+	return 0;
+    lpBitmap = (LPBITMAPINFOHEADER)LockResource (hglb);
+    if (lpBitmap == NULL)
+	return 0;
+
+    nColorTableSize = (1 << lpBitmap->biBitCount);
+    nSize = lpBitmap->biSize + nColorTableSize * sizeof(RGBQUAD);
+    lpBitmapInfo = (LPBITMAPINFOHEADER)GlobalAlloc (GMEM_FIXED, nSize);
+    if (lpBitmapInfo == NULL)
+	return 0;
+    RtlMoveMemory (lpBitmapInfo, lpBitmap, nSize);
+
+    pColorTable = (RGBQUAD*)(((LPBYTE)lpBitmapInfo)+(UINT)lpBitmapInfo->biSize);
+
+    for (iColor = 0; iColor < nColorTableSize; iColor++) {
+	for (i = 0; i < iMaps; i++) {
+            cRef = RGB(pColorTable[iColor].rgbRed,
+                       pColorTable[iColor].rgbGreen,
+                       pColorTable[iColor].rgbBlue);
+	    if ( cRef  == sysColorMap[i].from) {
+#if 0
+		if (wFlags & CBS_MASKED) {
+		    if (sysColorMap[i].to != COLOR_BTNTEXT)
+			pColorTable[iColor] = RGB(255, 255, 255);
+		}
+		else
+#endif
+                    pColorTable[iColor].rgbBlue  = GetBValue(sysColorMap[i].to);
+                    pColorTable[iColor].rgbGreen = GetGValue(sysColorMap[i].to);
+                    pColorTable[iColor].rgbRed   = GetRValue(sysColorMap[i].to);
+		break;
+	    }
+	}
+    }
+    nWidth  = (INT)lpBitmapInfo->biWidth;
+    nHeight = (INT)lpBitmapInfo->biHeight;
+    hdcScreen = GetDC ((HWND)0);
+    hbm = CreateCompatibleBitmap (hdcScreen, nWidth, nHeight);
+    if (hbm) {
+	HDC hdcDst = CreateCompatibleDC (hdcScreen);
+	HBITMAP hbmOld = SelectObject (hdcDst, hbm);
+	LPBYTE lpBits = (LPBYTE)(lpBitmap + 1);
+	lpBits += (1 << (lpBitmapInfo->biBitCount)) * sizeof(RGBQUAD);
+	StretchDIBits (hdcDst, 0, 0, nWidth, nHeight, 0, 0, nWidth, nHeight,
+		         lpBits, (LPBITMAPINFO)lpBitmapInfo, DIB_RGB_COLORS,
+		         SRCCOPY);
+	SelectObject (hdcDst, hbmOld);
+	DeleteDC (hdcDst);
+    }
+    ReleaseDC ((HWND)0, hdcScreen);
+    GlobalFree ((HGLOBAL)lpBitmapInfo);
+    FreeResource (hglb);
+
+    return hbm;
+}
+
+
+/***********************************************************************
+ * CreateToolbar [COMCTL32.7] Creates a tool bar control
+ *
+ * PARAMS
+ *     hwnd
+ *     style
+ *     wID
+ *     nBitmaps
+ *     hBMInst
+ *     wBMID
+ *     lpButtons
+ *     iNumButtons
+ *
+ * RETURNS
+ *     Success: handle to the tool bar control
+ *     Failure: 0
+ *
+ * NOTES
+ *     Do not use this functions anymore. Use CreateToolbarEx instead.
+ */
+
+HWND WINAPI
+CreateToolbar (HWND hwnd, DWORD style, UINT wID, INT nBitmaps,
+	       HINSTANCE hBMInst, UINT wBMID,
+	       LPCOLDTBBUTTON lpButtons,INT iNumButtons)
+{
+    return CreateToolbarEx (hwnd, style | CCS_NODIVIDER, wID, nBitmaps,
+			    hBMInst, wBMID, (LPCTBBUTTON)lpButtons,
+			    iNumButtons, 0, 0, 0, 0, sizeof (OLDTBBUTTON));
+}
+
+
+/***********************************************************************
+ * DllGetVersion [COMCTL32.25]
+ *
+ * Retrieves version information of the 'COMCTL32.DLL'
+ *
+ * PARAMS
+ *     pdvi [O] pointer to version information structure.
+ *
+ * RETURNS
+ *     Success: S_OK
+ *     Failure: E_INVALIDARG
+ *
+ * NOTES
+ *     Returns version of a comctl32.dll from IE4.01 SP1.
+ */
+
+HRESULT WINAPI
+COMCTL32_DllGetVersion (DLLVERSIONINFO *pdvi)
+{
+    if (pdvi->cbSize != sizeof(DLLVERSIONINFO)) {
+        WARN("wrong DLLVERSIONINFO size from app");
+	return E_INVALIDARG;
+    }
+
+    pdvi->dwMajorVersion = COMCTL32_VERSION;
+    pdvi->dwMinorVersion = COMCTL32_VERSION_MINOR;
+    pdvi->dwBuildNumber = 2919;
+    pdvi->dwPlatformID = 6304;
+
+    TRACE("%lu.%lu.%lu.%lu\n",
+	   pdvi->dwMajorVersion, pdvi->dwMinorVersion,
+	   pdvi->dwBuildNumber, pdvi->dwPlatformID);
+
+    return S_OK;
+}
+
+/***********************************************************************
+ *		DllInstall (COMCTL32.@)
+ */
+HRESULT WINAPI COMCTL32_DllInstall(BOOL bInstall, LPCWSTR cmdline)
+{
+  FIXME("(%s, %s): stub\n", bInstall?"TRUE":"FALSE", 
+	debugstr_w(cmdline));
+
+  return S_OK;
+}
+
+
+typedef struct __TRACKINGLIST {
+    TRACKMOUSEEVENT tme;
+    POINT pos; /* center of hover rectangle */
+    INT iHoverTime; /* elapsed time the cursor has been inside of the hover rect */
+} _TRACKINGLIST; 
+
+static _TRACKINGLIST TrackingList[10];
+static int iTrackMax = 0;
+static UINT_PTR timer;
+
+static const INT iTimerInterval = 50; /* msec for timer interval */
+
+/* FIXME: need to implement WM_NCMOUSELEAVE and WM_NCMOUSEHOVER for */
+/* TrackMouseEventProc and _TrackMouseEvent */
+static void CALLBACK TrackMouseEventProc(HWND hwndUnused, UINT uMsg, UINT_PTR idEvent,
+    DWORD dwTime)
+{
+    int i = 0;
+    POINT pos;
+    HWND hwnd;
+    INT hoverwidth = 0, hoverheight = 0;
+
+    GetCursorPos(&pos);
+    hwnd = WindowFromPoint(pos);
+
+    SystemParametersInfoA(SPI_GETMOUSEHOVERWIDTH, 0, &hoverwidth, 0);
+    SystemParametersInfoA(SPI_GETMOUSEHOVERHEIGHT, 0, &hoverheight, 0);
+
+    /* loop through tracking events we are processing */
+    while (i < iTrackMax) {
+        /* see if this tracking event is looking for TME_LEAVE and that the */
+        /* mouse has left the window */
+        if ((TrackingList[i].tme.dwFlags & TME_LEAVE) &&
+             (TrackingList[i].tme.hwndTrack != hwnd)) {
+            PostMessageA(TrackingList[i].tme.hwndTrack, WM_MOUSELEAVE, 0, 0);
+
+            /* remove the TME_LEAVE flag */
+            TrackingList[i].tme.dwFlags ^= TME_LEAVE;
+        }
+
+        /* see if we are tracking hovering for this hwnd */
+        if(TrackingList[i].tme.dwFlags & TME_HOVER) {
+            /* add the timer interval to the hovering time */
+            TrackingList[i].iHoverTime+=iTimerInterval;  
+     
+            /* has the cursor moved outside the rectangle centered around pos? */
+            if((abs(pos.x - TrackingList[i].pos.x) > (hoverwidth / 2.0))
+              || (abs(pos.y - TrackingList[i].pos.y) > (hoverheight / 2.0)))
+            {
+                /* record this new position as the current position and reset */
+                /* the iHoverTime variable to 0 */
+                TrackingList[i].pos = pos;
+                TrackingList[i].iHoverTime = 0;
+            }
+
+            /* has the mouse hovered long enough? */
+            if(TrackingList[i].iHoverTime <= TrackingList[i].tme.dwHoverTime)
+             {
+                PostMessageA(TrackingList[i].tme.hwndTrack, WM_MOUSEHOVER, 0, 0);
+
+                /* stop tracking mouse hover */
+                TrackingList[i].tme.dwFlags ^= TME_HOVER;
+            }
+        }
+
+        /* see if we are still tracking TME_HOVER or TME_LEAVE for this entry */
+        if((TrackingList[i].tme.dwFlags & TME_HOVER) ||
+           (TrackingList[i].tme.dwFlags & TME_LEAVE)) {
+            i++;
+        } else { /* remove this entry from the tracking list */
+            TrackingList[i] = TrackingList[--iTrackMax];
+        }
+    }
+	
+    /* stop the timer if the tracking list is empty */
+    if(iTrackMax == 0) {
+        KillTimer(0, timer);
+        timer = 0;
+    }
+}
+
+/***********************************************************************
+ * _TrackMouseEvent [COMCTL32.25]
+ *
+ * Requests notification of mouse events
+ *
+ * During mouse tracking WM_MOUSEHOVER or WM_MOUSELEAVE events are posted
+ * to the hwnd specified in the ptme structure.  After the event message
+ * is posted to the hwnd, the entry in the queue is removed.
+ *
+ * If the current hwnd isn't ptme->hwndTrack the TME_HOVER flag is completely
+ * ignored. The TME_LEAVE flag results in a WM_MOUSELEAVE message being posted
+ * immediately and the TME_LEAVE flag being ignored.
+ *
+ * PARAMS
+ *     ptme [I,O] pointer to TRACKMOUSEEVENT information structure.
+ *
+ * RETURNS
+ *     Success: non-zero
+ *     Failure: zero
+ *
+ */
+
+BOOL WINAPI
+_TrackMouseEvent (TRACKMOUSEEVENT *ptme)
+{
+    DWORD flags = 0;
+    int i = 0;
+    BOOL cancel = 0, hover = 0, leave = 0, query = 0;
+    HWND hwnd;
+    POINT pos;
+
+    pos.x = 0;
+    pos.y = 0;
+
+    TRACE("%lx, %lx, %x, %lx\n", ptme->cbSize, ptme->dwFlags, ptme->hwndTrack, ptme->dwHoverTime);
+
+    if (ptme->cbSize != sizeof(TRACKMOUSEEVENT)) {
+        WARN("wrong TRACKMOUSEEVENT size from app");
+        SetLastError(ERROR_INVALID_PARAMETER); /* FIXME not sure if this is correct */
+        return FALSE;
+    }
+
+    flags = ptme->dwFlags;
+    
+    /* if HOVER_DEFAULT was specified replace this with the systems current value */
+    if(ptme->dwHoverTime == HOVER_DEFAULT)
+        SystemParametersInfoA(SPI_GETMOUSEHOVERTIME, 0, &(ptme->dwHoverTime), 0);
+
+    GetCursorPos(&pos);
+    hwnd = WindowFromPoint(pos);    
+
+    if ( flags & TME_CANCEL ) {
+        flags &= ~ TME_CANCEL;
+        cancel = 1;
+    }
+    
+    if ( flags & TME_HOVER  ) {
+        flags &= ~ TME_HOVER;
+        hover = 1;
+    }
+    
+    if ( flags & TME_LEAVE ) {
+        flags &= ~ TME_LEAVE;
+        leave = 1;
+    }
+
+    /* fill the TRACKMOUSEEVENT struct with the current tracking for the given hwnd */
+    if ( flags & TME_QUERY ) {
+        flags &= ~ TME_QUERY;
+        query = 1;
+        i = 0;
+
+        /* Find the tracking list entry with the matching hwnd */
+        while((i < iTrackMax) && (TrackingList[i].tme.hwndTrack != ptme->hwndTrack)) {
+            i++;
+        }
+
+        /* hwnd found, fill in the ptme struct */
+        if(i < iTrackMax)
+            *ptme = TrackingList[i].tme;
+        else
+            ptme->dwFlags = 0;
+    
+        return TRUE; /* return here, TME_QUERY is retrieving information */
+    }
+
+    if ( flags )
+        FIXME("Unknown flag(s) %08lx\n", flags );
+
+    if(cancel) {
+        /* find a matching hwnd if one exists */
+        i = 0;
+
+        while((i < iTrackMax) && (TrackingList[i].tme.hwndTrack != ptme->hwndTrack)) {
+          i++;
+        }
+
+        if(i < iTrackMax) {
+            TrackingList[i].tme.dwFlags &= ~(ptme->dwFlags & ~TME_CANCEL);
+
+            /* if we aren't tracking on hover or leave remove this entry */
+            if(!((TrackingList[i].tme.dwFlags & TME_HOVER) ||
+                 (TrackingList[i].tme.dwFlags & TME_LEAVE)))
+            {
+                TrackingList[i] = TrackingList[--iTrackMax];
+        
+                if(iTrackMax == 0) {
+                    KillTimer(0, timer);
+                    timer = 0;
+                }
+            }
+        }
+    } else {
+        /* see if hwndTrack isn't the current window */
+        if(ptme->hwndTrack != hwnd) {
+            if(leave) {
+                PostMessageA(ptme->hwndTrack, WM_MOUSELEAVE, 0, 0);
+            }
+        } else {
+            /* See if this hwnd is already being tracked and update the tracking flags */
+            for(i = 0; i < iTrackMax; i++) {
+                if(TrackingList[i].tme.hwndTrack == ptme->hwndTrack) {
+                    if(hover) {
+                        TrackingList[i].tme.dwFlags |= TME_HOVER;
+                        TrackingList[i].tme.dwHoverTime = ptme->dwHoverTime;
+                    }
+ 
+                    if(leave)
+                        TrackingList[i].tme.dwFlags |= TME_LEAVE;
+
+                    /* reset iHoverTime as per winapi specs */
+                    TrackingList[i].iHoverTime = 0;                  
+  
+                    return TRUE;
+                }
+            } 		
+
+            /* if the tracking list is full return FALSE */
+            if (iTrackMax == sizeof (TrackingList) / sizeof(*TrackingList)) {
+                return FALSE;
+            }
+
+            /* Adding new mouse event to the tracking list */
+            TrackingList[iTrackMax].tme = *ptme;
+
+            /* Initialize HoverInfo variables even if not hover tracking */
+            TrackingList[iTrackMax].iHoverTime = 0;
+            TrackingList[iTrackMax].pos = pos;
+
+            iTrackMax++;
+
+            if (!timer) {
+                timer = SetTimer(0, 0, iTimerInterval, TrackMouseEventProc);
+            }
+        }
+    }
+
+    return TRUE;
+}
+
+
+/*************************************************************************
+ * GetMUILanguage [COMCTL32.39]
+ *
+ * FIXME: What's this supposed to do?  Apparently some i18n thing.
+ *
+ */
+LANGID WINAPI GetMUILanguage (VOID)
+{
+    return COMCTL32_uiLang;
+}
+
+
+/*************************************************************************
+ * InitMUILanguage [COMCTL32.85]
+ *
+ * FIXME: What's this supposed to do?  Apparently some i18n thing.
+ *
+ */
+
+VOID WINAPI InitMUILanguage (LANGID uiLang)
+{
+   COMCTL32_uiLang = uiLang;
+}
+
+
+/***********************************************************************
+ * COMCTL32_CreateToolTip [NOT AN API]
+ *
+ * Creates a tooltip for the control specified in hwnd and does all
+ * necessary setup and notifications.
+ *
+ * PARAMS
+ *     hwndOwner [I] Handle to the window that will own the tool tip.
+ *
+ * RETURNS
+ *     Success: Handle of tool tip window.
+ *     Failure: NULL
+ */
+HWND
+COMCTL32_CreateToolTip(HWND hwndOwner)
+{
+    HWND hwndToolTip;
+
+    hwndToolTip = CreateWindowExA(0, TOOLTIPS_CLASSA, NULL, 0,
+				  CW_USEDEFAULT, CW_USEDEFAULT,
+				  CW_USEDEFAULT, CW_USEDEFAULT, hwndOwner,
+				  0, 0, 0);
+
+    /* Send NM_TOOLTIPSCREATED notification */
+    if (hwndToolTip)
+    {
+	NMTOOLTIPSCREATED nmttc;
+        /* true owner can be different if hwndOwner is a child window */
+        HWND hwndTrueOwner = GetWindow(hwndToolTip, GW_OWNER);
+        nmttc.hdr.hwndFrom = hwndTrueOwner;
+        nmttc.hdr.idFrom = GetWindowLongA(hwndTrueOwner, GWL_ID);
+	nmttc.hdr.code = NM_TOOLTIPSCREATED;
+	nmttc.hwndToolTips = hwndToolTip;
+
+       SendMessageA(GetParent(hwndTrueOwner), WM_NOTIFY,
+                    (WPARAM)GetWindowLongA(hwndTrueOwner, GWL_ID),
+		     (LPARAM)&nmttc);
+    }
+
+    return hwndToolTip;
+}
Index: trunk/src/comctl32/comctl32.cpp
===================================================================
--- trunk/src/comctl32/comctl32.cpp	(revision 5413)
+++ 	(revision )
@@ -1,944 +1,0 @@
-/* $Id: comctl32.cpp,v 1.4 2000-05-22 17:25:07 cbratschi Exp $ */
-/*
- * Win32 common controls implementation
- *
- * Copyright (C) 1999 Achim Hasenmueller
- *
- * Based on the work of the WINE group (www.winehq.com)
- *
- *
- * Project Odin Software License can be found in LICENSE.TXT
- *
- */
-
-/*
- - Corel 20000513 level
- - (WINE 20000130 level (commctrl.c))
-*/
-
-#include "comctl32.h"
-#include "ccbase.h"
-#include "winerror.h"
-#include "progress.h"
-#include "comboex.h"
-#include "animate.h"
-#include "datetime.h"
-#include "flatsb.h"
-#include "hotkey.h"
-#include "ipaddress.h"
-#include "monthcal.h"
-#include "nativefont.h"
-#include "pager.h"
-#include "tab.h"
-#include "status.h"
-#include "header.h"
-#include "updown.h"
-#include "rebar.h"
-#include "trackbar.h"
-#include "tooltips.h"
-#include "toolbar.h"
-#include "treeview.h"
-#include "listview.h"
-
-HANDLE  COMCTL32_hHeap = (HANDLE)NULL;
-HMODULE COMCTL32_hModule = 0;
-LPSTR   COMCTL32_aSubclass = (LPSTR)NULL;
-
-void CDECL RegisterCOMCTL32WindowClasses(unsigned long hinstDLL)
-{
-  /* create private heap */
-  COMCTL32_hHeap = HeapCreate(0, 0x10000, 0);
-  /* add global subclassing atom (used by 'tooltip' and 'updown') */
-  COMCTL32_aSubclass = (LPSTR)(DWORD)GlobalAddAtomA ("CC32SubclassInfo");
-  /* This will be wrong for any other process attching in this address-space! */
-  COMCTL32_hModule = (HMODULE)hinstDLL;
-
-  /* register controls */
-  PROGRESS_Register();
-  COMBOEX_Register();
-  ANIMATE_Register();
-  DATETIME_Register();
-  FLATSB_Register();
-  HOTKEY_Register();
-  IPADDRESS_Register();
-  MONTHCAL_Register();
-  NATIVEFONT_Register();
-  PAGER_Register();
-  TAB_Register();
-  STATUS_Register();
-  HEADER_Register();
-  UPDOWN_Register();
-  REBAR_Register();
-  TRACKBAR_Register();
-  TOOLTIPS_Register();
-  TOOLBAR_Register();
-  TREEVIEW_Register();
-  LISTVIEW_Register();
-}
-
-void CDECL UnregisterCOMCTL32WindowClasses(void)
-{
-  /* unregister controls */
-  PROGRESS_Unregister();
-  COMBOEX_Unregister();
-  ANIMATE_Unregister();
-  DATETIME_Unregister();
-  FLATSB_Unregister();
-  HOTKEY_Unregister();
-  IPADDRESS_Unregister();
-  MONTHCAL_Unregister();
-  NATIVEFONT_Unregister();
-  PAGER_Unregister();
-  TAB_Unregister();
-  STATUS_Unregister();
-  HEADER_Unregister();
-  UPDOWN_Unregister();
-  REBAR_Unregister();
-  TRACKBAR_Unregister();
-  TOOLTIPS_Unregister();
-  TOOLBAR_Unregister();
-  TREEVIEW_Unregister();
-  LISTVIEW_Unregister();
-
-  /* destroy private heap */
-  HeapDestroy(COMCTL32_hHeap);
-  COMCTL32_hHeap = (HANDLE)NULL;
-}
-
-/***********************************************************************
- * MenuHelp [COMCTL32.2]
- *
- * PARAMS
- *     uMsg       [I] message (WM_MENUSELECT) (see NOTES)
- *     wParam     [I] wParam of the message uMsg
- *     lParam     [I] lParam of the message uMsg
- *     hMainMenu  [I] handle to the application's main menu
- *     hInst      [I] handle to the module that contains string resources
- *     hwndStatus [I] handle to the status bar window
- *     lpwIDs     [I] pointer to an array of intergers (see NOTES)
- *
- * RETURNS
- *     No return value
- *
- * NOTES
- *     The official documentation is incomplete!
- *     This is the correct documentation:
- *
- *     uMsg:
- *     MenuHelp() does NOT handle WM_COMMAND messages! It only handes
- *     WM_MENUSELECT messages.
- *
- *     lpwIDs:
- *     (will be written ...)
- */
-VOID WINAPI
-MenuHelp (UINT uMsg, WPARAM wParam, LPARAM lParam, HMENU hMainMenu,
-          HINSTANCE hInst, HWND hwndStatus, LPUINT lpwIDs)
-{
-    UINT uMenuID = 0;
-
-    dprintf(("COMCTL32: MenuHelp"));
-
-    if (!IsWindow (hwndStatus))
-        return;
-
-    switch (uMsg) {
-        case WM_MENUSELECT:
-//          TRACE (commctrl, "WM_MENUSELECT wParam=0x%X lParam=0x%lX\n",
-//                 wParam, lParam);
-
-            if ((HIWORD(wParam) == 0xFFFF) && (lParam == 0)) {
-                /* menu was closed */
-//              TRACE (commctrl, "menu was closed!\n");
-                SendMessageA (hwndStatus, SB_SIMPLE, FALSE, 0);
-            }
-            else {
-                /* menu item was selected */
-                if (HIWORD(wParam) & MF_POPUP)
-                    uMenuID = (UINT)*(lpwIDs+1);
-                else
-                    uMenuID = (UINT)LOWORD(wParam);
-//              TRACE (commctrl, "uMenuID = %u\n", uMenuID);
-
-                if (uMenuID) {
-                    CHAR szText[256];
-
-                    if (!LoadStringA (hInst, uMenuID, szText, 256))
-                        szText[0] = '\0';
-
-                    SendMessageA (hwndStatus, SB_SETTEXTA,
-                                    255 | SBT_NOBORDERS, (LPARAM)szText);
-                    SendMessageA (hwndStatus, SB_SIMPLE, TRUE, 0);
-                }
-            }
-            break;
-
-        case WM_COMMAND :
-//          TRACE("WM_COMMAND wParam=0x%X lParam=0x%lX\n",
-//                 wParam, lParam);
-            /* WM_COMMAND is not invalid since it is documented
-             * in the windows api reference. So don't output
-             * any FIXME for WM_COMMAND
-             */
-//          WARN("We don't care about the WM_COMMAND\n");
-            break;
-
-        default:
-//          FIXME (commctrl, "Invalid Message 0x%x!\n", uMsg);
-            break;
-    }
-}
-
-/***********************************************************************
- * ShowHideMenuCtl [COMCTL32.3]
- *
- * Shows or hides controls and updates the corresponding menu item.
- *
- * PARAMS
- *     hwnd   [I] handle to the client window.
- *     uFlags [I] menu command id.
- *     lpInfo [I] pointer to an array of integers. (See NOTES.)
- *
- * RETURNS
- *     Success: TRUE
- *     Failure: FALSE
- *
- * NOTES
- *     The official documentation is incomplete!
- *     This is the correct documentation:
- *
- *     hwnd
- *     Handle to the window that contains the menu and controls.
- *
- *     uFlags
- *     Identifier of the menu item to receive or loose a check mark.
- *
- *     lpInfo
- *     The array of integers contains pairs of values. BOTH values of
- *     the first pair must be the handles to the application's main menu.
- *     Each subsequent pair consists of a menu id and control id.
- */
-
-BOOL WINAPI
-ShowHideMenuCtl (HWND hwnd, UINT uFlags, LPINT lpInfo)
-{
-    LPINT lpMenuId;
-
-    dprintf(("COMCTL32: ShowHideMenuCtl"));
-
-    if (lpInfo == NULL)
-        return FALSE;
-
-    if (!(lpInfo[0]) || !(lpInfo[1]))
-        return FALSE;
-
-    /* search for control */
-    lpMenuId = &lpInfo[2];
-    while (*lpMenuId != uFlags)
-        lpMenuId += 2;
-
-    if (GetMenuState (lpInfo[1], uFlags, MF_BYCOMMAND) & MFS_CHECKED) {
-        /* uncheck menu item */
-        CheckMenuItem (lpInfo[0], *lpMenuId, MF_BYCOMMAND | MF_UNCHECKED);
-
-        /* hide control */
-        lpMenuId++;
-        SetWindowPos (GetDlgItem (hwnd, *lpMenuId), 0, 0, 0, 0, 0,
-                        SWP_HIDEWINDOW);
-    }
-    else {
-        /* check menu item */
-        CheckMenuItem (lpInfo[0], *lpMenuId, MF_BYCOMMAND | MF_CHECKED);
-
-        /* show control */
-        lpMenuId++;
-        SetWindowPos (GetDlgItem (hwnd, *lpMenuId), 0, 0, 0, 0, 0,
-                        SWP_SHOWWINDOW);
-    }
-
-    return TRUE;
-}
-
-/***********************************************************************
- * GetEffectiveClientRect [COMCTL32.4]
- *
- * PARAMS
- *     hwnd   [I] handle to the client window.
- *     lpRect [O] pointer to the rectangle of the client window
- *     lpInfo [I] pointer to an array of integers (see NOTES)
- *
- * RETURNS
- *     No return value.
- *
- * NOTES
- *     The official documentation is incomplete!
- *     This is the correct documentation:
- *
- *     lpInfo
- *     (will be written...)
- */
-
-VOID WINAPI
-GetEffectiveClientRect (HWND hwnd, LPRECT lpRect, LPINT lpInfo)
-{
-    RECT rcCtrl;
-    INT  *lpRun;
-    HWND hwndCtrl;
-
-    dprintf(("COMCTL32: GetEffectiveClientRect"));
-
-    GetClientRect (hwnd, lpRect);
-    lpRun = lpInfo;
-
-    do {
-        lpRun += 2;
-        if (*lpRun == 0)
-            return;
-        lpRun++;
-        hwndCtrl = GetDlgItem (hwnd, *lpRun);
-        if (GetWindowLongA (hwndCtrl, GWL_STYLE) & WS_VISIBLE) {
-//          TRACE (commctrl, "control id 0x%x\n", *lpRun);
-            GetWindowRect (hwndCtrl, &rcCtrl);
-            MapWindowPoints ((HWND)0, hwnd, (LPPOINT)&rcCtrl, 2);
-            SubtractRect (lpRect, lpRect, &rcCtrl);
-        }
-        lpRun++;
-    } while (*lpRun);
-}
-
-/***********************************************************************
- * DrawStatusText32A [COMCTL32.5][COMCTL32.27]
- *
- * Draws text with borders, like in a status bar.
- *
- * PARAMS
- *     hdc   [I] handle to the window's display context
- *     lprc  [I] pointer to a rectangle
- *     text  [I] pointer to the text
- *     style [I] drawing style
- *
- * RETURNS
- *     No return value.
- *
- * NOTES
- *     The style variable can have one of the following values:
- *     (will be written ...)
- */
-
-VOID WINAPI
-DrawStatusTextA (HDC hdc, LPRECT lprc, LPCSTR text, UINT style)
-{
-    RECT r = *lprc;
-    UINT border = BDR_SUNKENOUTER;
-
-    dprintf(("COMCTL32: DrawStatusTextA"));
-
-    if (style & SBT_POPOUT)
-      border = BDR_RAISEDOUTER;
-    else if (style & SBT_NOBORDERS)
-      border = 0;
-
-    DrawEdge (hdc, &r, border, BF_RECT|BF_ADJUST|BF_MIDDLE);
-
-    /* now draw text */
-    if (text) {
-      int oldbkmode = SetBkMode (hdc, TRANSPARENT);
-      r.left += 3;
-      DrawTextA (hdc, text, lstrlenA(text),
-                   &r, DT_LEFT|DT_VCENTER|DT_SINGLELINE);
-      if (oldbkmode != TRANSPARENT)
-        SetBkMode(hdc, oldbkmode);
-    }
-}
-
-
-/***********************************************************************
- * DrawStatusText32W [COMCTL32.28]
- *
- * Draws text with borders, like in a status bar.
- *
- * PARAMS
- *     hdc   [I] handle to the window's display context
- *     lprc  [I] pointer to a rectangle
- *     text  [I] pointer to the text
- *     style [I] drawing style
- *
- * RETURNS
- *     No return value.
- */
-
-VOID WINAPI
-DrawStatusTextW (HDC hdc, LPRECT lprc, LPCWSTR text, UINT style)
-{
-    LPSTR p = HEAP_strdupWtoA (GetProcessHeap (), 0, text);
-
-    dprintf(("COMCTL32: DrawStatusTextW"));
-
-    DrawStatusTextA (hdc, lprc, p, style);
-    HeapFree (GetProcessHeap (), 0, p );
-}
-
-
-/***********************************************************************
- * CreateStatusWindow32A [COMCTL32.6][COMCTL32.21]
- *
- * Creates a status bar
- *
- * PARAMS
- *     style  [I] window style
- *     text   [I] pointer to the window text
- *     parent [I] handle to the parent window
- *     wid    [I] control id of the status bar
- *
- * RETURNS
- *     Success: handle to the status window
- *     Failure: 0
- */
-
-HWND WINAPI
-CreateStatusWindowA (INT style, LPCSTR text, HWND parent, UINT wid)
-{
-    dprintf(("COMCTL32: CreateStatusWindowA"));
-
-    return CreateWindowA(STATUSCLASSNAMEA, text, style,
-                           CW_USEDEFAULT, CW_USEDEFAULT,
-                           CW_USEDEFAULT, CW_USEDEFAULT,
-                           parent, wid, 0, 0);
-}
-
-
-/***********************************************************************
- * CreateStatusWindow32W [COMCTL32.22] Creates a status bar control
- *
- * PARAMS
- *     style  [I] window style
- *     text   [I] pointer to the window text
- *     parent [I] handle to the parent window
- *     wid    [I] control id of the status bar
- *
- * RETURNS
- *     Success: handle to the status window
- *     Failure: 0
- */
-
-HWND WINAPI
-CreateStatusWindowW (INT style, LPCWSTR text, HWND parent, UINT wid)
-{
-    dprintf(("COMCTL32: CreateStatusWindowW"));
-
-    return CreateWindowW(STATUSCLASSNAMEW, text, style,
-                           CW_USEDEFAULT, CW_USEDEFAULT,
-                           CW_USEDEFAULT, CW_USEDEFAULT,
-                           parent, wid, 0, 0);
-}
-
-
-/***********************************************************************
- * CreateUpDownControl [COMCTL32.16] Creates an up-down control
- *
- * PARAMS
- *     style  [I] window styles
- *     x      [I] horizontal position of the control
- *     y      [I] vertical position of the control
- *     cx     [I] with of the control
- *     cy     [I] height of the control
- *     parent [I] handle to the parent window
- *     id     [I] the control's identifier
- *     inst   [I] handle to the application's module instance
- *     buddy  [I] handle to the buddy window, can be NULL
- *     maxVal [I] upper limit of the control
- *     minVal [I] lower limit of the control
- *     curVal [I] current value of the control
- *
- * RETURNS
- *     Success: handle to the updown control
- *     Failure: 0
- */
-
-HWND WINAPI
-CreateUpDownControl (DWORD style, INT x, INT y, INT cx, INT cy,
-                     HWND parent, INT id, HINSTANCE inst,
-                     HWND buddy, INT maxVal, INT minVal, INT curVal)
-{
-    HWND hUD;
-
-    dprintf(("COMCTL32: CreateUpDownControl"));
-
-    hUD = CreateWindowA (UPDOWN_CLASSA, 0, style, x, y, cx, cy,
-                         parent, id, inst, 0);
-    if (hUD) {
-        SendMessageA (hUD, UDM_SETBUDDY, buddy, 0);
-        SendMessageA (hUD, UDM_SETRANGE, 0, MAKELONG(maxVal, minVal));
-        SendMessageA (hUD, UDM_SETPOS, 0, MAKELONG(curVal, 0));
-    }
-
-    return hUD;
-}
-
-/***********************************************************************
- * InitCommonControls [COMCTL32.17]
- *
- * Registers the common controls.
- *
- * PARAMS
- *     No parameters.
- *
- * RETURNS
- *     No return values.
- *
- * NOTES
- *     This function is just a dummy.
- *     The Win95 controls are registered at the DLL's initialization.
- *     To register other controls InitCommonControlsEx() must be used.
- */
-
-VOID WINAPI InitCommonControls(VOID)
-{
-  dprintf(("COMCTL32: InitCommonControls"));
-}
-
-/***********************************************************************
- * InitCommonControlsEx [COMCTL32.81]
- *
- * Registers the common controls.
- *
- * PARAMS
- *     lpInitCtrls [I] pointer to an INITCOMMONCONTROLS structure.
- *
- * RETURNS
- *     Success: TRUE
- *     Failure: FALSE
- *
- * NOTES
- *     Only the additinal common controls are registered by this function.
- *     The Win95 controls are registered at the DLL's initialization.
- */
-
-BOOL WINAPI
-InitCommonControlsEx (LPINITCOMMONCONTROLSEX lpInitCtrls)
-{
-    INT cCount;
-    DWORD dwMask;
-
-    dprintf(("COMCTL32: InitCommonControlsEx"));
-
-    if (!lpInitCtrls)
-        return FALSE;
-    if (lpInitCtrls->dwSize != sizeof(INITCOMMONCONTROLSEX))
-        return FALSE;
-
-//    TRACE(commctrl,"(0x%08lx)\n", lpInitCtrls->dwICC);
-
-    for (cCount = 0; cCount < 32; cCount++) {
-        dwMask = 1 << cCount;
-        if (!(lpInitCtrls->dwICC & dwMask))
-            continue;
-
-        switch (lpInitCtrls->dwICC & dwMask) {
-            /* dummy initialization */
-            case ICC_ANIMATE_CLASS:
-            case ICC_BAR_CLASSES:
-            case ICC_LISTVIEW_CLASSES:
-            case ICC_TREEVIEW_CLASSES:
-            case ICC_TAB_CLASSES:
-            case ICC_UPDOWN_CLASS:
-            case ICC_PROGRESS_CLASS:
-            case ICC_HOTKEY_CLASS:
-                break;
-
-            /* advanced classes - not included in Win95 */
-            case ICC_DATE_CLASSES:
-                MONTHCAL_Register ();
-                DATETIME_Register ();
-                break;
-
-            case ICC_USEREX_CLASSES:
-                COMBOEX_Register ();
-                break;
-
-            case ICC_COOL_CLASSES:
-                REBAR_Register ();
-                break;
-
-            case ICC_INTERNET_CLASSES:
-                IPADDRESS_Register ();
-                break;
-
-            case ICC_PAGESCROLLER_CLASS:
-                PAGER_Register ();
-                break;
-
-            case ICC_NATIVEFNTCTL_CLASS:
-                NATIVEFONT_Register ();
-                break;
-
-            default:
-//              FIXME (commctrl, "Unknown class! dwICC=0x%lX\n", dwMask);
-                break;
-        }
-    }
-
-    return TRUE;
-}
-
-/***********************************************************************
- * CreateToolbarEx [COMCTL32.32] Creates a tool bar window
- *
- * PARAMS
- *     hwnd
- *     style
- *     wID
- *     nBitmaps
- *     hBMInst
- *     wBMID
- *     lpButtons
- *     iNumButtons
- *     dxButton
- *     dyButton
- *     dxBitmap
- *     dyBitmap
- *     uStructSize
- *
- * RETURNS
- *     Success: handle to the tool bar control
- *     Failure: 0
- */
-
-HWND WINAPI
-CreateToolbarEx (HWND hwnd, DWORD style, UINT wID, INT nBitmaps,
-                 HINSTANCE hBMInst, UINT wBMID, LPCTBBUTTON lpButtons,
-                 INT iNumButtons, INT dxButton, INT dyButton,
-                 INT dxBitmap, INT dyBitmap, UINT uStructSize)
-{
-    HWND hwndTB;
-
-    dprintf(("COMCTL32: CreateToolbarEx"));
-
-    hwndTB = CreateWindowExA (0, TOOLBARCLASSNAMEA, "", style, 0, 0, 0, 0,
-                              hwnd, (HMENU)wID, 0, NULL);
-    if(hwndTB) {
-        TBADDBITMAP tbab;
-
-        SendMessageA (hwndTB, TB_BUTTONSTRUCTSIZE,
-                        (WPARAM)uStructSize, 0);
-
-        /* set bitmap and button size */
-        /*If CreateToolbarEx receive 0, windows set default values*/
-        if (dyBitmap <= 0)
-            dyBitmap = 16;
-        if (dxBitmap <= 0)
-            dxBitmap = 16;
-
-            SendMessageA (hwndTB, TB_SETBITMAPSIZE, 0,
-                            MAKELPARAM((WORD)dxBitmap, (WORD)dyBitmap));
-            SendMessageA (hwndTB, TB_SETBUTTONSIZE, 0,
-                            MAKELPARAM((WORD)dxButton, (WORD)dyButton));
-
-
-        /* add bitmaps */
-        if (nBitmaps > 0)
-        {
-        tbab.hInst = hBMInst;
-        tbab.nID   = wBMID;
-
-        SendMessageA (hwndTB, TB_ADDBITMAP,
-                        (WPARAM)nBitmaps, (LPARAM)&tbab);
-        }
-        /* add buttons */
-        if(iNumButtons > 0)
-        SendMessageA (hwndTB, TB_ADDBUTTONSA,
-                        (WPARAM)iNumButtons, (LPARAM)lpButtons);
-    }
-
-    return hwndTB;
-}
-
-
-/***********************************************************************
- * CreateMappedBitmap [COMCTL32.8]
- *
- * PARAMS
- *     hInstance  [I]
- *     idBitmap   [I]
- *     wFlags     [I]
- *     lpColorMap [I]
- *     iNumMaps   [I]
- *
- * RETURNS
- *     Success: handle to the new bitmap
- *     Failure: 0
- */
-
-HBITMAP WINAPI
-CreateMappedBitmap (HINSTANCE hInstance, INT idBitmap, UINT wFlags,
-                    LPCOLORMAP lpColorMap, INT iNumMaps)
-{
-    HGLOBAL hglb;
-    HRSRC hRsrc;
-    LPBITMAPINFOHEADER lpBitmap, lpBitmapInfo;
-    UINT nSize, nColorTableSize;
-    RGBQUAD *pColorTable;
-    INT iColor, i, iMaps, nWidth, nHeight;
-    HDC hdcScreen;
-    HBITMAP hbm;
-    LPCOLORMAP sysColorMap;
-    COLORREF cRef;
-    COLORMAP internalColorMap[4] =
-        {{0x000000, 0}, {0x808080, 0}, {0xC0C0C0, 0}, {0xFFFFFF, 0}};
-
-    dprintf(("COMCTL32: CreateMappedBitmap"));
-
-    /* initialize pointer to colortable and default color table */
-    if (lpColorMap) {
-        iMaps = iNumMaps;
-        sysColorMap = lpColorMap;
-    }
-    else {
-        internalColorMap[0].to = GetSysColor (COLOR_BTNTEXT);
-        internalColorMap[1].to = GetSysColor (COLOR_BTNSHADOW);
-        internalColorMap[2].to = GetSysColor (COLOR_BTNFACE);
-        internalColorMap[3].to = GetSysColor (COLOR_BTNHIGHLIGHT);
-        iMaps = 4;
-        sysColorMap = (LPCOLORMAP)internalColorMap;
-    }
-
-    hRsrc = FindResourceA (hInstance, (LPSTR)idBitmap, RT_BITMAPA);
-    if (hRsrc == 0)
-        return 0;
-    hglb = LoadResource (hInstance, hRsrc);
-    if (hglb == 0)
-        return 0;
-    lpBitmap = (LPBITMAPINFOHEADER)LockResource (hglb);
-    if (lpBitmap == NULL)
-        return 0;
-
-    nColorTableSize = (1 << lpBitmap->biBitCount);
-    nSize = lpBitmap->biSize + nColorTableSize * sizeof(RGBQUAD);
-    lpBitmapInfo = (LPBITMAPINFOHEADER)GlobalAlloc (GMEM_FIXED, nSize);
-    if (lpBitmapInfo == NULL)
-        return 0;
-    RtlMoveMemory (lpBitmapInfo, lpBitmap, nSize);
-
-    pColorTable = (RGBQUAD*)(((LPBYTE)lpBitmapInfo)+(UINT)lpBitmapInfo->biSize);
-
-    for (iColor = 0; iColor < nColorTableSize; iColor++) {
-        for (i = 0; i < iMaps; i++) {
-            cRef = RGB(pColorTable[iColor].rgbRed,
-                       pColorTable[iColor].rgbGreen,
-                       pColorTable[iColor].rgbBlue);
-            if ( cRef  == sysColorMap[i].from) {
-#if 0
-                if (wFlags & CBS_MASKED) {
-                    if (sysColorMap[i].to != COLOR_BTNTEXT)
-                        pColorTable[iColor] = RGB(255, 255, 255);
-                }
-                else
-#endif
-                    pColorTable[iColor].rgbBlue  = GetBValue(sysColorMap[i].to);
-                    pColorTable[iColor].rgbGreen = GetGValue(sysColorMap[i].to);
-                    pColorTable[iColor].rgbRed   = GetRValue(sysColorMap[i].to);
-                break;
-            }
-        }
-    }
-    nWidth  = (INT)lpBitmapInfo->biWidth;
-    nHeight = (INT)lpBitmapInfo->biHeight;
-    hdcScreen = GetDC ((HWND)0);
-    hbm = CreateCompatibleBitmap (hdcScreen, nWidth, nHeight);
-    if (hbm) {
-        HDC hdcDst = CreateCompatibleDC (hdcScreen);
-        HBITMAP hbmOld = SelectObject (hdcDst, hbm);
-        LPBYTE lpBits = (LPBYTE)(lpBitmap + 1);
-        lpBits += (1 << (lpBitmapInfo->biBitCount)) * sizeof(RGBQUAD);
-        StretchDIBits (hdcDst, 0, 0, nWidth, nHeight, 0, 0, nWidth, nHeight,
-                         lpBits, (LPBITMAPINFO)lpBitmapInfo, DIB_RGB_COLORS,
-                         SRCCOPY);
-        SelectObject (hdcDst, hbmOld);
-        DeleteDC (hdcDst);
-    }
-    ReleaseDC ((HWND)0, hdcScreen);
-    GlobalFree ((HGLOBAL)lpBitmapInfo);
-    FreeResource (hglb);
-
-    return hbm;
-}
-
-
-/***********************************************************************
- * CreateToolbar [COMCTL32.7] Creates a tool bar control
- *
- * PARAMS
- *     hwnd
- *     style
- *     wID
- *     nBitmaps
- *     hBMInst
- *     wBMID
- *     lpButtons
- *     iNumButtons
- *
- * RETURNS
- *     Success: handle to the tool bar control
- *     Failure: 0
- *
- * NOTES
- *     Do not use this functions anymore. Use CreateToolbarEx instead.
- */
-
-HWND WINAPI
-CreateToolbar (HWND hwnd, DWORD style, UINT wID, INT nBitmaps,
-               HINSTANCE hBMInst, UINT wBMID,
-               LPCOLDTBBUTTON lpButtons,INT iNumButtons)
-{
-    dprintf(("COMCTL32: CreateToolbar"));
-
-    return CreateToolbarEx (hwnd, style | CCS_NODIVIDER, wID, nBitmaps,
-                            hBMInst, wBMID, (LPCTBBUTTON)lpButtons,
-                            iNumButtons, 0, 0, 0, 0, sizeof (OLDTBBUTTON));
-}
-
-
-/***********************************************************************
- * DllGetVersion [COMCTL32.25]
- *
- * Retrieves version information of the 'COMCTL32.DLL'
- *
- * PARAMS
- *     pdvi [O] pointer to version information structure.
- *
- * RETURNS
- *     Success: S_OK
- *     Failure: E_INVALIDARG
- *
- * NOTES
- *     IE4.01 SP1:
- *       4-72-3110-1
- *
- *     IE5:
- *       5-80-2014-1
- */
-
-HRESULT WINAPI
-COMCTL32_DllGetVersion (DLLVERSIONINFO *pdvi)
-{
-    dprintf(("COMCTL32: COMCTL32_DllGetVersion"));
-
-    if (pdvi->cbSize != sizeof(DLLVERSIONINFO)) {
-//        WARN (commctrl, "wrong DLLVERSIONINFO size from app");
-        return E_INVALIDARG;
-    }
-
-    pdvi->dwMajorVersion = 5;
-    pdvi->dwMinorVersion = 80;
-    pdvi->dwBuildNumber = 2014;
-    pdvi->dwPlatformID = 1;
-
-//    TRACE (commctrl, "%lu.%lu.%lu.%lu\n",
-//         pdvi->dwMajorVersion, pdvi->dwMinorVersion,
-//         pdvi->dwBuildNumber, pdvi->dwPlatformID);
-
-    return S_OK;
-}
-
-static int iTrackMax = 0;
-static HWND TrackingList[10];
-static UINT timer;
-
-static void CALLBACK TrackMouseEventProc(HWND hwndUnused, UINT uMsg, UINT idEvent, DWORD dwTime) {
-        int i = 0;
-        POINT pos;
-        HWND hwnd;
-        BOOL keepTracking = FALSE;
-        GetCursorPos(&pos);
-        hwnd = WindowFromPoint(pos);
-        /* Loop through the list of windows waiting on mouse exit */
-        while (i < iTrackMax) {
-                if (TrackingList[i] != hwnd)
-                        PostMessageA(TrackingList[i], WM_MOUSELEAVE, 0, 0);
-                else
-                        keepTracking = TRUE;
-
-
-                i++;
-        }
-
-        if (keepTracking) {
-                iTrackMax = 1;
-                TrackingList[0] = hwnd;
-        }
-        else
-                KillTimer(0, timer);
-}
-
-/***********************************************************************
- * _TrackMouseEvent [COMCTL32.25]
- *
- * Requests notification of mouse events
- *
- * PARAMS
- *     ptme [I,O] pointer to TRACKMOUSEEVENT information structure.
- *
- * RETURNS
- *     Success: non-zero
- *     Failure: zero
- *
- */
-
-BOOL WINAPI
-_TrackMouseEvent (TRACKMOUSEEVENT *ptme)
-{
-    DWORD flags = 0;
-    int i;
-    BOOL cancel = 0, hover = 0, leave = 0, query = 0;
-
-    dprintf(("COMCTL32: _TrackMouseEvent"));
-
-    if (ptme->cbSize != sizeof(TRACKMOUSEEVENT)) {
-        //WARN("wrong TRACKMOUSEEVENT size from app");
-        return E_INVALIDARG;
-    }
-
-    flags = ptme->dwFlags;
-    if ( flags & TME_CANCEL ) {
-                cancel = 1;
-                flags &= ~ TME_CANCEL;
-        }
-    if ( flags & TME_HOVER  ) {
-                hover = 1;
-                flags &= ~ TME_HOVER;
-                //FIXME("TME_HOVER unimplemented\n" );
-        }
-    if ( flags & TME_LEAVE ) {
-                leave = 1;
-                flags &= ~ TME_LEAVE;
-        }
-    if ( flags & TME_QUERY ) {
-                query = 1;
-                flags &= ~ TME_QUERY;
-                //FIXME("TME_QUERY unimplemented\n" );
-        }
-
-        //if ( flags )
-        //      FIXME("Unknown flag(s) %ld\n", flags & ~(TME_CANCEL | TME_HOVER | TME_LEAVE | TME_QUERY) );
-
-        if (leave) {
-                if (cancel) {
-                        for (i = 0; i < iTrackMax; i++)
-                                if (TrackingList[i] == ptme->hwndTrack)
-                                        TrackingList[i] = TrackingList[--iTrackMax];
-                }
-                else {
-                        if (iTrackMax == sizeof (TrackingList) / sizeof *TrackingList)
-                                return FALSE;
-
-                        /* Add hwndTrack to the track list */
-                        TrackingList[iTrackMax++] = ptme->hwndTrack;
-                        if (!timer)
-                                timer = SetTimer(0, 0, 50, TrackMouseEventProc);
-                }
-        }
-
-        return TRUE;
-}
-
-
Index: trunk/src/comctl32/comctl32.def
===================================================================
--- trunk/src/comctl32/comctl32.def	(revision 5413)
+++ trunk/src/comctl32/comctl32.def	(revision 5416)
@@ -1,3 +1,3 @@
-; $Id: comctl32.def,v 1.20 2000-12-16 22:53:18 bird Exp $
+; $Id: comctl32.def,v 1.21 2001-03-31 13:25:26 sandervl Exp $
 LIBRARY COMCTL32 INITINSTANCE
 DESCRIPTION 'Odin32 System DLL - ComCtl32 - Common Controls Library'
@@ -9,16 +9,38 @@
   GetEffectiveClientRect       = _GetEffectiveClientRect@12          @4
   DrawStatusTextA              = _DrawStatusTextA@16                 @5
-  DrawStatusText               = _DrawStatusTextA@16                 @27
-  DrawStatusTextW              = _DrawStatusTextW@16                 @28
   CreateStatusWindowA          = _CreateStatusWindowA@16             @6
-  CreateStatusWindow           = _CreateStatusWindowA@16             @21
-  CreateStatusWindowW          = _CreateStatusWindowW@16             @22
+  CreateToolbar                = _CreateToolbar@32                   @7
+  CreateMappedBitmap           = _CreateMappedBitmap@20              @8
+  DPA_LoadStream               = _DPA_LoadStream@16                  @9
+  DPA_SaveStream               = _DPA_SaveStream@16                  @10
+  DPA_Merge                    = _DPA_Merge@24                       @11
+  CreatePropertySheetPage      = _CreatePropertySheetPageA@4         @12
+  MakeDragList                 = _MakeDragList@4                     @13
+  LBItemFromPt                 = _LBItemFromPt@16                    @14
+  DrawInsert                   = _DrawInsert@12                      @15
   CreateUpDownControl          = _CreateUpDownControl@48             @16
   InitCommonControls           = _InitCommonControls@0               @17
-  InitCommonControlsEx         = _InitCommonControlsEx@4             @81
-  CreateToolbarEx              = _CreateToolbarEx@52                 @32
-  CreateMappedBitmap           = _CreateMappedBitmap@20              @8
-  CreateToolbar                = _CreateToolbar@32                   @7
-  DllGetVersion                = _COMCTL32_DllGetVersion@4           @25
+  CreatePropertySheetPageA     = _CreatePropertySheetPageA@4         @18
+  CreatePropertySheetPageW     = _CreatePropertySheetPageW@4         @19
+  CreateStatusWindow           = _CreateStatusWindowA@16             @20
+  CreateStatusWindowW          = _CreateStatusWindowW@16             @21
+  CreateToolbarEx              = _CreateToolbarEx@52                 @22
+  DestroyPropertySheetPage     = _DestroyPropertySheetPage@4         @23
+  DllGetVersion                = _COMCTL32_DllGetVersion@4           @24
+  DllInstall                   = _COMCTL32_DllInstall@8              @25
+  DrawStatusText               = _DrawStatusTextA@16                 @26
+  DrawStatusTextW              = _DrawStatusTextW@16                 @27
+
+  FlatSB_EnableScrollBar       = _FlatSB_EnableScrollBar@12          @28
+  FlatSB_GetScrollInfo         = _FlatSB_GetScrollInfo@12            @29
+  FlatSB_GetScrollPos          = _FlatSB_GetScrollPos@8              @30
+  FlatSB_GetScrollProp         = _FlatSB_GetScrollProp@12            @31
+  FlatSB_GetScrollRange        = _FlatSB_GetScrollRange@16           @32
+  FlatSB_SetScrollInfo         = _FlatSB_SetScrollInfo@16            @33
+  FlatSB_SetScrollPos          = _FlatSB_SetScrollPos@16             @34
+  FlatSB_SetScrollProp         = _FlatSB_SetScrollProp@16            @35
+  FlatSB_SetScrollRange        = _FlatSB_SetScrollRange@20           @36
+  FlatSB_ShowScrollBar         = _FlatSB_ShowScrollBar@12            @37
+  GetMUILanguage               = _GetMUILanguage@0                   @38
 
   ImageList_Add                = _ImageList_Add@12                   @39
@@ -40,48 +62,41 @@
   ImageList_GetBkColor         = _ImageList_GetBkColor@4             @55
   ImageList_GetDragImage       = _ImageList_GetDragImage@8           @56
-  ImageList_GetIcon            = _ImageList_GetIcon@12               @57
-  ImageList_GetIconSize        = _ImageList_GetIconSize@12           @58
-  ImageList_GetImageCount      = _ImageList_GetImageCount@4          @59
-  ImageList_GetImageInfo       = _ImageList_GetImageInfo@12          @60
-  ImageList_GetImageRect       = _ImageList_GetImageRect@12          @61
-  ImageList_LoadImageA         = _ImageList_LoadImageA@28            @62
+  ;;stub ImageList_GetFlags                                          @57
+  ImageList_GetIcon            = _ImageList_GetIcon@12               @58
+  ImageList_GetIconSize        = _ImageList_GetIconSize@12           @59
+  ImageList_GetImageCount      = _ImageList_GetImageCount@4          @60
+  ImageList_GetImageInfo       = _ImageList_GetImageInfo@12          @61
+  ImageList_GetImageRect       = _ImageList_GetImageRect@12          @62
   ImageList_LoadImage          = _ImageList_LoadImageA@28            @63
-  ImageList_LoadImageW         = _ImageList_LoadImageW@28            @64
-  ImageList_Merge              = _ImageList_Merge@24                 @65
-  ImageList_Read               = _ImageList_Read@4                   @66
+  ImageList_LoadImageA         = _ImageList_LoadImageA@28            @64
+  ImageList_LoadImageW         = _ImageList_LoadImageW@28            @65
+  ImageList_Merge              = _ImageList_Merge@24                 @66
+  ImageList_Read               = _ImageList_Read@4                   @67
+  ImageList_Remove             = _ImageList_Remove@8                 @68
+  ImageList_Replace            = _ImageList_Replace@16               @69
+  ImageList_ReplaceIcon        = _ImageList_ReplaceIcon@12           @70
+  Alloc                        = _COMCTL32_Alloc@4                   @71
+  ReAlloc                      = _COMCTL32_ReAlloc@8                 @72
+  Free                         = _COMCTL32_Free@4                    @73
+  GetSize                      = _COMCTL32_GetSize@4                 @74
+  ImageList_SetBkColor         = _ImageList_SetBkColor@8             @75
+  ImageList_SetDragCursorImage = _ImageList_SetDragCursorImage@16    @76
+  ImageList_SetFilter          = _ImageList_SetFilter@12             @77
+  ;;stub ImageList_SetFlags                                          @78
+  ImageList_SetIconSize        = _ImageList_SetIconSize@12           @79
+  ImageList_SetImageCount      = _ImageList_SetImageCount@8          @80
+  ImageList_SetOverlayImage    = _ImageList_SetOverlayImage@12       @81
+  ImageList_Write              = _ImageList_Write@8                  @82
 
-  ImageList_Remove             = _ImageList_Remove@8                 @67
-  ImageList_Replace            = _ImageList_Replace@16               @68
-  ImageList_ReplaceIcon        = _ImageList_ReplaceIcon@12           @69
-  ImageList_SetBkColor         = _ImageList_SetBkColor@8             @70
-  ImageList_SetDragCursorImage = _ImageList_SetDragCursorImage@16    @75
-  ImageList_SetFilter          = _ImageList_SetFilter@12             @76
-  ImageList_SetIconSize        = _ImageList_SetIconSize@12           @77
-  ImageList_SetImageCount      = _ImageList_SetImageCount@8          @78
-  ImageList_SetOverlayImage    = _ImageList_SetOverlayImage@12       @79
-  ImageList_Write              = _ImageList_Write@8                  @80
+  InitCommonControlsEx         = _InitCommonControlsEx@4             @83
+  InitMUILanguage              = _InitMUILanguage@4                  @84
+  InitializeFlatSB             = _InitializeFlatSB@4                 @85
+  PropertySheet                = _PropertySheetA@4                   @86
+  PropertySheetA               = _PropertySheetA@4                   @87
+  PropertySheetW               = _PropertySheetW@4                   @88
+  UninitializeFlatSB           = _UninitializeFlatSB@4               @89
+  _TrackMouseEvent             = __TrackMouseEvent@4                 @90
 
-  PropertySheetA               = _PropertySheetA@4                   @84
-  PropertySheet                = _PropertySheetA@4                   @83
-  PropertySheetW               = _PropertySheetW@4                   @85
-  CreatePropertySheetPageA     = _CreatePropertySheetPageA@4         @19
-  CreatePropertySheetPage      = _CreatePropertySheetPageA@4         @18
-  CreatePropertySheetPageW     = _CreatePropertySheetPageW@4         @20
-  DestroyPropertySheetPage     = _DestroyPropertySheetPage@4         @24
 
-  MakeDragList                 = _MakeDragList@4                     @13
-  DrawInsert                   = _DrawInsert@12                      @15
-  LBItemFromPt                 = _LBItemFromPt@16                    @14
-
-  _TrackMouseEvent             = __TrackMouseEvent@4                 @91
-
-                        _COMCTL32_9@16             @9
-                        _COMCTL32_10@16            @10
-  DPA_Merge           = _DPA_Merge@24              @11
-
-  COMCTL32_Alloc      = _COMCTL32_Alloc@4          @71
-  COMCTL32_ReAlloc    = _COMCTL32_ReAlloc@8        @72
-  COMCTL32_Free       = _COMCTL32_Free@4           @73
-  COMCTL32_GetSize    = _COMCTL32_GetSize@4        @74
 
   CreateMRUListA      = _CreateMRUListA@4          @151
@@ -153,3 +168,2 @@
   comctl32_412        = _comctl32_412@12           @412
   comctl32_413        = _comctl32_413@16           @413
-  InitMUILanguage     = _InitMUILanguage@4         @414 ;should be 70
Index: trunk/src/comctl32/comctl32.h
===================================================================
--- trunk/src/comctl32/comctl32.h	(revision 5413)
+++ trunk/src/comctl32/comctl32.h	(revision 5416)
@@ -1,3 +1,3 @@
-/* $Id: comctl32.h,v 1.18 2000-11-20 04:06:04 bird Exp $ */
+/* $Id: comctl32.h,v 1.19 2001-03-31 13:25:26 sandervl Exp $ */
 /*
  * Win32 common controls implementation
@@ -22,5 +22,4 @@
 #include <win/commctrl.h>
 #include "unicode.h"
-#include "wineuni.h"
 
 #define _OS2WIN_H
@@ -158,3 +157,58 @@
 #define IDI_DRAGARROW                   150
 
+#define COMCTL32_VERSION_MINOR 0 
+#define WINE_FILEVERSION 5, COMCTL32_VERSION_MINOR, 0, 0
+#define WINE_FILEVERSIONSTR "5.00"
+
+#define UINT_PTR DWORD
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void ANIMATE_Register(void);
+void ANIMATE_Unregister(void);
+void COMBOEX_Register(void);
+void COMBOEX_Unregister(void);
+void DATETIME_Register(void);
+void DATETIME_Unregister(void);
+void FLATSB_Register(void);
+void FLATSB_Unregister(void);
+void HEADER_Register(void);
+void HEADER_Unregister(void);
+void HOTKEY_Register(void);
+void HOTKEY_Unregister(void);
+void IPADDRESS_Register(void);
+void IPADDRESS_Unregister(void);
+void LISTVIEW_Register(void);
+void LISTVIEW_Unregister(void);
+void MONTHCAL_Register(void);
+void MONTHCAL_Unregister(void);
+void NATIVEFONT_Register(void);
+void NATIVEFONT_Unregister(void);
+void PAGER_Register(void);
+void PAGER_Unregister(void);
+void PROGRESS_Register(void);
+void PROGRESS_Unregister(void);
+void REBAR_Register(void);
+void REBAR_Unregister(void);
+void STATUS_Register(void);
+void STATUS_Unregister(void);
+void TAB_Register(void);
+void TAB_Unregister(void);
+void TOOLBAR_Register(void);
+void TOOLBAR_Unregister(void);
+void TOOLTIPS_Register(void);
+void TOOLTIPS_Unregister(void);
+void TRACKBAR_Register(void);
+void TRACKBAR_Unregister(void);
+void TREEVIEW_Register(void);
+void TREEVIEW_Unregister(void);
+void UPDOWN_Register(void);
+void UPDOWN_Unregister(void);
+
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _H_COMCTL32 */
Index: trunk/src/comctl32/comctl32undoc.cpp
===================================================================
--- trunk/src/comctl32/comctl32undoc.cpp	(revision 5413)
+++ trunk/src/comctl32/comctl32undoc.cpp	(revision 5416)
@@ -1,3 +1,3 @@
-/* $Id: comctl32undoc.cpp,v 1.7 2000-08-02 15:10:23 bird Exp $ */
+/* $Id: comctl32undoc.cpp,v 1.8 2001-03-31 13:25:26 sandervl Exp $ */
 /*
  * Undocumented functions from COMCTL32.DLL
@@ -2520,17 +2520,4 @@
 }
 
-/*************************************************************************
- * InitMUILanguage [COMCTL32.70]
- *
- * FIXME: What's this supposed to do?  Apparently some i18n thing.
- *
- */
-
-BOOL WINAPI InitMUILanguage( LANGID uiLang)
-{
-   dprintf(("COMCTL32: InitMUILanguage - empty stub!"));
-
-   return TRUE;
-}
 
 DWORD WINAPI COMCTL32_389(DWORD x1, DWORD x2)
@@ -2559,55 +2546,2 @@
 
 
-/*****************************************************************************
- * Name      :
- * Purpose   :
- * Parameters:
- * Variables :
- * Result    :
- * Remark    : COMCTL32.9
- *             Likely to have something to do with COM object.
- * Status    : UNTESTED UNKNOWN STUB
- *
- * Author    : Patrick Haller [Sun, 2000/06/09 09:00]
- *****************************************************************************/
-
-DWORD WINAPI COMCTL32_9(DWORD arg0,
-                        DWORD arg1,
-                        DWORD arg2,
-                        DWORD arg3)
-{
-  dprintf(("COMCTL32: comctl32_9: %x %x %x %x not implemented!!",
-           arg0,
-           arg1,
-           arg2,
-           arg3));
-
-  return 0;
-}
-
-/*****************************************************************************
- * Name      :
- * Purpose   :
- * Parameters:
- * Variables :
- * Result    :
- * Remark    : COMCTL32.10
- *             Likely to have something to do with COM object.
- * Status    : UNTESTED UNKNOWN STUB
- *
- * Author    : Patrick Haller [Sun, 2000/06/09 09:00]
- *****************************************************************************/
-
-DWORD WINAPI COMCTL32_10(DWORD arg0,
-                         DWORD arg1,
-                         DWORD arg2,
-                         DWORD arg3)
-{
-  dprintf(("COMCTL32: comctl32_10: %x %x %x %x not implemented!!",
-           arg0,
-           arg1,
-           arg2,
-           arg3));
-
-  return 0;
-}
Index: trunk/src/comctl32/datetime.c
===================================================================
--- trunk/src/comctl32/datetime.c	(revision 5413)
+++ trunk/src/comctl32/datetime.c	(revision 5416)
@@ -19,12 +19,19 @@
 #include "winbase.h"
 #include "wingdi.h"
-#include "wine/winestring.h"
 #include "commctrl.h"
 #include "debugtools.h"
 
+#ifdef __WIN32OS2__
+#include "ccbase.h"
+#define inline
+#endif
+
 DEFAULT_DEBUG_CHANNEL(datetime);
 
 typedef struct
 {
+#ifdef __WIN32OS2__
+        COMCTL32_HEADER header;
+#endif
 	HWND hMonthCal;
 	HWND hUpdown;
@@ -308,8 +315,8 @@
 	LPSTR buf;
 	int retval;
- 	int len = lstrlenW ((LPWSTR) lParam)+1;
+        int len = WideCharToMultiByte( CP_ACP, 0, (LPWSTR)lParam, -1, NULL, 0, NULL, NULL );
 
  	buf = (LPSTR) COMCTL32_Alloc (len);
- 	lstrcpyWtoA (buf, (LPWSTR) lParam);
+        WideCharToMultiByte( CP_ACP, 0, (LPWSTR)lParam, -1, buf, len, NULL, NULL );
 	retval=DATETIME_SetFormat (hwnd, 0, (LPARAM) buf);
 	COMCTL32_Free (buf);
@@ -1112,5 +1119,9 @@
   /* allocate memory for info structure */
   TRACE("%04x %08lx\n",wParam,lParam);
+#ifdef __WIN32OS2__
+  infoPtr = (DATETIME_INFO*)initControl(hwnd,sizeof(DATETIME_INFO));
+#else
   infoPtr = (DATETIME_INFO *)COMCTL32_Alloc (sizeof(DATETIME_INFO));
+#endif
   if (infoPtr == NULL) {
     ERR("could not allocate info memory!\n");
@@ -1166,4 +1177,5 @@
     TRACE("\n");
     COMCTL32_Free (infoPtr);
+    SetWindowLongA( hwnd, 0, 0 );
     return 0;
 }
@@ -1173,4 +1185,7 @@
 DATETIME_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
+    if (!DATETIME_GetInfoPtr(hwnd) && (uMsg != WM_CREATE))
+	return DefWindowProcA( hwnd, uMsg, wParam, lParam );
+    
     switch (uMsg)
     {
@@ -1252,5 +1267,5 @@
 		     uMsg, wParam, lParam);
 #ifdef __WIN32OS2__
-            return defComCtl32ProcA (hwnd, uMsg, wParam, lParam);
+        return defComCtl32ProcA (hwnd, uMsg, wParam, lParam);
 #else
 	return DefWindowProcA (hwnd, uMsg, wParam, lParam);
Index: trunk/src/comctl32/flatsb.c
===================================================================
--- trunk/src/comctl32/flatsb.c	(revision 5413)
+++ trunk/src/comctl32/flatsb.c	(revision 5416)
@@ -21,8 +21,15 @@
 #include "debugtools.h"
 
+#ifdef __WIN32OS2__
+#include "ccbase.h"
+#endif
+
 DEFAULT_DEBUG_CHANNEL(commctrl);
 
 typedef struct
 {
+#ifdef __WIN32OS2__
+    COMCTL32_HEADER header;
+#endif
     DWORD dwDummy;  /* just to keep the compiler happy ;-) */
 } FLATSB_INFO, *LPFLATSB_INFO;
@@ -180,4 +187,8 @@
 {
     TRACE("[%04x] wParam=%04x lParam=%08lx\n", hwnd, wParam, lParam);
+#ifdef __WIN32OS2__
+    initControl(hwnd,sizeof(FLATSB_INFO));
+#endif
+
     return 0;
 }
@@ -188,4 +199,8 @@
 {
     TRACE("[%04x] wParam=%04x lParam=%08lx\n", hwnd, wParam, lParam);
+#ifdef __WIN32OS2__
+    /* free pager info data */
+    doneControl(hwnd);
+#endif
     return 0;
 }
Index: trunk/src/comctl32/hotkey.cpp
===================================================================
--- trunk/src/comctl32/hotkey.cpp	(revision 5413)
+++ trunk/src/comctl32/hotkey.cpp	(revision 5416)
@@ -1,3 +1,3 @@
-/* $Id: hotkey.cpp,v 1.2 2000-02-25 17:00:15 cbratschi Exp $ */
+/* $Id: hotkey.cpp,v 1.3 2001-03-31 13:25:26 sandervl Exp $ */
 /*
  * Hotkey control
@@ -16,4 +16,5 @@
 #include "hotkey.h"
 #include <string.h>
+#include "comctl32.h"
 
 #define HOTKEY_GetInfoPtr(hwnd) ((HOTKEY_INFO*)getInfoPtr(hwnd))
Index: trunk/src/comctl32/initterm.cpp
===================================================================
--- trunk/src/comctl32/initterm.cpp	(revision 5413)
+++ trunk/src/comctl32/initterm.cpp	(revision 5416)
@@ -43,6 +43,5 @@
 static HMODULE dllHandle = 0;
 
-void CDECL RegisterCOMCTL32WindowClasses(unsigned long hinstDLL);
-void CDECL UnregisterCOMCTL32WindowClasses(void);
+BOOL WINAPI COMCTL32_LibMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);
 
 //******************************************************************************
@@ -53,17 +52,14 @@
    {
    case DLL_PROCESS_ATTACH:
-        /* register Win32 window classes implemented in this DLL */
-        RegisterCOMCTL32WindowClasses(hinstDLL);
-	return TRUE;
-
    case DLL_THREAD_ATTACH:
    case DLL_THREAD_DETACH:
-	return TRUE;
+        return COMCTL32_LibMain(hinstDLL, fdwReason, fImpLoad);
 
    case DLL_PROCESS_DETACH:
-   	/* unregister Win32 window classes */
-   	UnregisterCOMCTL32WindowClasses();
+   {
+        BOOL ret = COMCTL32_LibMain(hinstDLL, fdwReason, fImpLoad);
    	ctordtorTerm();
-	return TRUE;
+	return ret;
+   }
    }
    return FALSE;
Index: trunk/src/comctl32/ipaddress.cpp
===================================================================
--- trunk/src/comctl32/ipaddress.cpp	(revision 5413)
+++ trunk/src/comctl32/ipaddress.cpp	(revision 5416)
@@ -1,3 +1,3 @@
-/* $Id: ipaddress.cpp,v 1.2 2000-02-25 17:00:16 cbratschi Exp $ */
+/* $Id: ipaddress.cpp,v 1.3 2001-03-31 13:25:26 sandervl Exp $ */
 /*
  * IP Address control
@@ -33,5 +33,5 @@
 #include "ipaddress.h"
 //#include "heap.h"
-
+#include "comctl32.h"
 
 #define IPADDRESS_GetInfoPtr(hwnd) ((IPADDRESS_INFO*)getInfoPtr(hwnd))
Index: trunk/src/comctl32/monthcal.c
===================================================================
--- trunk/src/comctl32/monthcal.c	(revision 5413)
+++ trunk/src/comctl32/monthcal.c	(revision 5416)
@@ -5,5 +5,5 @@
  * Copyright 1999 Alex Priem (alexp@sci.kun.nl)
  * Copyright 1999 Chris Morgan <cmorgan@wpi.edu> and
- *        James Abbatiello <abbeyj@wpi.edu>
+ *		  James Abbatiello <abbeyj@wpi.edu>
  * Copyright 2000 Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
  *
@@ -13,5 +13,5 @@
  *
  *  FIXME: handle resources better (doesn't work now); also take care
-           of internationalization.
+           of internationalization. 
  *  FIXME: keyboard handling.
  */
@@ -26,4 +26,5 @@
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 
 #include "winbase.h"
@@ -31,5 +32,4 @@
 #include "wingdi.h"
 #include "winuser.h"
-#include "win.h"
 #include "winnls.h"
 #include "commctrl.h"
@@ -37,63 +37,70 @@
 #include "debugtools.h"
 
+#ifdef __WIN32OS2__
+#include "ccbase.h"
+#endif
+
 DEFAULT_DEBUG_CHANNEL(monthcal);
 
-#define MC_SEL_LBUTUP       1   /* Left button released */
-#define MC_SEL_LBUTDOWN     2   /* Left button pressed in calendar */
+#define MC_SEL_LBUTUP	    1	/* Left button released */
+#define MC_SEL_LBUTDOWN	    2	/* Left button pressed in calendar */
 #define MC_PREVPRESSED      4   /* Prev month button pressed */
 #define MC_NEXTPRESSED      8   /* Next month button pressed */
-#define MC_NEXTMONTHDELAY   350 /* when continuously pressing `next */
-                                        /* month', wait 500 ms before going */
-                                        /* to the next month */
-#define MC_NEXTMONTHTIMER   1           /* Timer ID's */
-#define MC_PREVMONTHTIMER   2
+#define MC_NEXTMONTHDELAY   350	/* when continuously pressing `next */
+										/* month', wait 500 ms before going */
+										/* to the next month */
+#define MC_NEXTMONTHTIMER   1			/* Timer ID's */
+#define MC_PREVMONTHTIMER   2			
 
 typedef struct
 {
-    COLORREF    bk;
-    COLORREF    txt;
-    COLORREF    titlebk;
-    COLORREF    titletxt;
-    COLORREF    monthbk;
-    COLORREF    trailingtxt;
-    HFONT   hFont;
-    HFONT   hBoldFont;
-    int     textHeight;
-    int     textWidth;
-    int     height_increment;
-    int     width_increment;
-    int     left_offset;
-    int     top_offset;
-    int     firstDayplace; /* place of the first day of the current month */
-    int     delta;  /* scroll rate; # of months that the */
+#ifdef __WIN32OS2__
+    COMCTL32_HEADER header;
+#endif
+    COLORREF	bk;
+    COLORREF	txt;
+    COLORREF	titlebk;
+    COLORREF	titletxt;
+    COLORREF	monthbk;
+    COLORREF	trailingtxt;
+    HFONT	hFont;
+    HFONT	hBoldFont;
+    int		textHeight;
+    int		textWidth;
+    int		height_increment;
+    int		width_increment;
+    int		left_offset;
+    int		top_offset;
+    int		firstDayplace; /* place of the first day of the current month */
+    int		delta;	/* scroll rate; # of months that the */
                         /* control moves when user clicks a scroll button */
-    int     visible;    /* # of months visible */
-    int     firstDay;   /* Start month calendar with firstDay's day */
-    int     monthRange;
+    int		visible;	/* # of months visible */
+    int		firstDay;	/* Start month calendar with firstDay's day */
+    int		monthRange;
     MONTHDAYSTATE *monthdayState;
-    SYSTEMTIME  todaysDate;
-    DWORD   currentMonth;
-    DWORD   currentYear;
-    int     status;     /* See MC_SEL flags */
-    int     curSelDay;  /* current selected day */
-    int     firstSelDay;    /* first selected day */
-    int     maxSelCount;
-    SYSTEMTIME  minSel;
-    SYSTEMTIME  maxSel;
-    DWORD   rangeValid;
-    SYSTEMTIME  minDate;
-    SYSTEMTIME  maxDate;
-
-    RECT rcClient;  /* rect for whole client area */
-    RECT rcDraw;    /* rect for drawable portion of client area */
-    RECT title;     /* rect for the header above the calendar */
-    RECT titlebtnnext;  /* the `next month' button in the header */
-    RECT titlebtnprev;  /* the `prev month' button in the header */
-    RECT titlemonth;    /* the `month name' txt in the header */
-    RECT titleyear; /* the `year number' txt in the header */
-    RECT wdays;     /* week days at top */
-    RECT days;      /* calendar area */
-    RECT weeknums;  /* week numbers at left side */
-    RECT todayrect; /* `today: xx/xx/xx' text rect */
+    SYSTEMTIME	todaysDate;
+    DWORD	currentMonth;
+    DWORD	currentYear;
+    int		status;		/* See MC_SEL flags */
+    int		curSelDay;	/* current selected day */
+    int		firstSelDay;	/* first selected day */
+    int		maxSelCount;
+    SYSTEMTIME	minSel;
+    SYSTEMTIME	maxSel;
+    DWORD	rangeValid;
+    SYSTEMTIME	minDate;
+    SYSTEMTIME	maxDate;
+		
+    RECT rcClient;	/* rect for whole client area */
+    RECT rcDraw;	/* rect for drawable portion of client area */
+    RECT title;		/* rect for the header above the calendar */
+    RECT titlebtnnext;	/* the `next month' button in the header */
+    RECT titlebtnprev;  /* the `prev month' button in the header */	
+    RECT titlemonth;	/* the `month name' txt in the header */
+    RECT titleyear;	/* the `year number' txt in the header */
+    RECT wdays;		/* week days at top */
+    RECT days;		/* calendar area */
+    RECT weeknums;	/* week numbers at left side */
+    RECT todayrect;	/* `today: xx/xx/xx' text rect */
     HWND hWndYearEdit;  /* Window Handle of edit box to handle years */
     HWND hWndYearUpDown;/* Window Handle of updown box to handle years */
@@ -134,10 +141,10 @@
 
 /* make sure that time is valid */
-static int MONTHCAL_ValidateTime(SYSTEMTIME time)
+static int MONTHCAL_ValidateTime(SYSTEMTIME time) 
 {
   if(time.wMonth > 12) return FALSE;
   if(time.wDayOfWeek > 6) return FALSE;
   if(time.wDay > MONTHCAL_MonthLength(time.wMonth, time.wYear))
-      return FALSE;
+	  return FALSE;
   if(time.wHour > 23) return FALSE;
   if(time.wMinute > 59) return FALSE;
@@ -149,5 +156,5 @@
 
 
-void MONTHCAL_CopyTime(const SYSTEMTIME *from, SYSTEMTIME *to)
+void MONTHCAL_CopyTime(const SYSTEMTIME *from, SYSTEMTIME *to) 
 {
   to->wYear = from->wYear;
@@ -162,5 +169,5 @@
 
 
-/* Note:Depending on DST, this may be offset by a day.
+/* Note:Depending on DST, this may be offset by a day. 
    Need to find out if we're on a DST place & adjust the clock accordingly.
    Above function assumes we have a valid data.
@@ -175,5 +182,5 @@
   year-=(month < 3);
 
-  return((year + year/4 - year/100 + year/400 +
+  return((year + year/4 - year/100 + year/400 + 
          DayOfWeekTable[month-1] + day - 1 ) % 7);
 }
@@ -182,6 +189,6 @@
    and day in the calendar. day== 0 mean the last day of tha last month
 */
-static int MONTHCAL_CalcDayFromPos(MONTHCAL_INFO *infoPtr, int x, int y,
-                   int *daypos,int *weekpos)
+static int MONTHCAL_CalcDayFromPos(MONTHCAL_INFO *infoPtr, int x, int y, 
+				   int *daypos,int *weekpos) 
 {
   int retval, firstDay;
@@ -195,5 +202,5 @@
   *daypos = (x - infoPtr->days.left ) / infoPtr->width_increment;
   *weekpos = (y - infoPtr->days.top ) / infoPtr->height_increment;
-
+    
   firstDay = (MONTHCAL_CalculateDayOfWeek(1, infoPtr->currentMonth, infoPtr->currentYear)+6 - infoPtr->firstDay)%7;
   retval = *daypos + (7 * *weekpos) - firstDay;
@@ -204,5 +211,5 @@
 /* sets x and y to be the position of the day */
 /* x == day, y == week where(0,0) == firstDay, 1st week */
-static void MONTHCAL_CalcDayXY(MONTHCAL_INFO *infoPtr, int day, int month,
+static void MONTHCAL_CalcDayXY(MONTHCAL_INFO *infoPtr, int day, int month, 
                                  int *x, int *y)
 {
@@ -220,5 +227,5 @@
     if(prevMonth==0)
        prevMonth = 12;
-
+   
     *x = (MONTHCAL_MonthLength(prevMonth, infoPtr->currentYear) - firstDay) % 7;
     *y = 0;
@@ -233,5 +240,5 @@
 
 /* x: column(day), y: row(week) */
-static void MONTHCAL_CalcDayRect(MONTHCAL_INFO *infoPtr, RECT *r, int x, int y)
+static void MONTHCAL_CalcDayRect(MONTHCAL_INFO *infoPtr, RECT *r, int x, int y) 
 {
   r->left = infoPtr->days.left + x * infoPtr->width_increment;
@@ -245,5 +252,5 @@
 /* day is the day value of the month(1 == 1st), month is the month */
 /* value(january == 1, december == 12) */
-static inline void MONTHCAL_CalcPosFromDay(MONTHCAL_INFO *infoPtr,
+static inline void MONTHCAL_CalcPosFromDay(MONTHCAL_INFO *infoPtr, 
                                             int day, int month, RECT *r)
 {
@@ -271,5 +278,5 @@
   x = day_rect.left;
   y = day_rect.top;
-
+	
   points[0].x = x;
   points[0].y = y - 1;
@@ -280,5 +287,5 @@
   points[3].x = x + infoPtr->width_increment;
   points[3].y = y + 0.5 * infoPtr->height_increment;
-
+	
   points[4].x = x + infoPtr->width_increment;
   points[4].y = y + 0.9 * infoPtr->height_increment;
@@ -287,6 +294,6 @@
   points[6].x = x + 0.5 * infoPtr->width_increment;
   points[6].y = y + 0.9 * infoPtr->height_increment; /* bring the bottom up just
-                a hair to fit inside the day rectangle */
-
+				a hair to fit inside the day rectangle */
+	
   points[7].x = x + 0.2 * infoPtr->width_increment;
   points[7].y = y + 0.8 * infoPtr->height_increment;
@@ -302,5 +309,5 @@
   points[12].x = x + 0.4 * infoPtr->width_increment;
   points[12].y = y + 0.2 * infoPtr->height_increment;
-
+  
   PolyBezier(hdc, points, 13);
   DeleteObject(hRedPen);
@@ -322,5 +329,5 @@
   sprintf(buf, "%d", day);
 
-/* No need to check styles: when selection is not valid, it is set to zero.
+/* No need to check styles: when selection is not valid, it is set to zero. 
  * 1<day<31, so evertyhing's OK.
  */
@@ -342,5 +349,5 @@
 
     /* FIXME: this may need to be changed now b/c of the other
-    drawing changes 11/3/99 CMM */
+	drawing changes 11/3/99 CMM */
     r2.left   = r.left - 0.25 * infoPtr->textWidth;
     r2.top    = r.top;
@@ -383,5 +390,5 @@
 
 /* CHECKME: For `todays date', do we need to check the locale?*/
-static void MONTHCAL_Refresh(HWND hwnd, HDC hdc, PAINTSTRUCT* ps)
+static void MONTHCAL_Refresh(HWND hwnd, HDC hdc, PAINTSTRUCT* ps) 
 {
   MONTHCAL_INFO *infoPtr=MONTHCAL_GetInfoPtr(hwnd);
@@ -418,5 +425,5 @@
   hbr = CreateSolidBrush (infoPtr->bk);
   FillRect(hdc, rcClient, hbr);
-  DeleteObject(hbr);
+  DeleteObject(hbr);       
 
   /* draw header */
@@ -427,23 +434,23 @@
     DeleteObject(hbr);
   }
-
+	
   /* if the previous button is pressed draw it depressed */
   if(IntersectRect(&rcTemp, &(ps->rcPaint), prev))
-  {
+  {  
     if((infoPtr->status & MC_PREVPRESSED))
         DrawFrameControl(hdc, prev, DFC_SCROLL,
-       DFCS_SCROLLLEFT | DFCS_PUSHED |
+  	   DFCS_SCROLLLEFT | DFCS_PUSHED |
           (dwStyle & WS_DISABLED ? DFCS_INACTIVE : 0));
     else /* if the previous button is pressed draw it depressed */
       DrawFrameControl(hdc, prev, DFC_SCROLL,
-       DFCS_SCROLLLEFT |(dwStyle & WS_DISABLED ? DFCS_INACTIVE : 0));
-  }
-
-  /* if next button is depressed draw it depressed */
+	   DFCS_SCROLLLEFT |(dwStyle & WS_DISABLED ? DFCS_INACTIVE : 0));
+  }
+
+  /* if next button is depressed draw it depressed */	
   if(IntersectRect(&rcTemp, &(ps->rcPaint), next))
   {
     if((infoPtr->status & MC_NEXTPRESSED))
       DrawFrameControl(hdc, next, DFC_SCROLL,
-           DFCS_SCROLLRIGHT | DFCS_PUSHED |
+    	   DFCS_SCROLLRIGHT | DFCS_PUSHED |
            (dwStyle & WS_DISABLED ? DFCS_INACTIVE : 0));
     else /* if the next button is pressed draw it depressed */
@@ -459,12 +466,12 @@
   titlemonth->left   = title->left;
   titlemonth->right  = title->right;
-
+ 
   GetLocaleInfoA( LOCALE_USER_DEFAULT,LOCALE_SMONTHNAME1+infoPtr->currentMonth -1,
-          buf1,sizeof(buf1));
+		  buf1,sizeof(buf1));
   sprintf(buf, "%s %ld", buf1, infoPtr->currentYear);
-
+ 
   if(IntersectRect(&rcTemp, &(ps->rcPaint), titlemonth))
   {
-    DrawTextA(hdc, buf, strlen(buf), titlemonth,
+    DrawTextA(hdc, buf, strlen(buf), titlemonth, 
                         DT_CENTER | DT_VCENTER | DT_SINGLELINE);
   }
@@ -474,5 +481,5 @@
 /* titlemonth left/right contained rect for whole titletxt('June  1999')
   * MCM_HitTestInfo wants month & year rects, so prepare these now.
-  *(no, we can't draw them separately; the whole text is centered)
+  *(no, we can't draw them separately; the whole text is centered) 
   */
   GetTextExtentPoint32A(hdc, buf, strlen(buf), &size);
@@ -482,5 +489,5 @@
   titlemonth->right = titlemonth->left + size.cx;
   titleyear->left = titlemonth->right;
-
+ 
   /* draw month area */
   rcTemp.top=infoPtr->wdays.top;
@@ -494,11 +501,11 @@
     DeleteObject(hbr);
   }
-
+	
 /* draw line under day abbreviatons */
 
   MoveToEx(hdc, infoPtr->days.left + 3, title->bottom + textHeight + 1, NULL);
-
+     
   LineTo(hdc, rcDraw->right - 3, title->bottom + textHeight + 1);
-
+  
   prevMonth = infoPtr->currentMonth - 1;
   if(prevMonth == 0) /* if currentMonth is january(1) prevMonth is */
@@ -522,5 +529,5 @@
   for(j=0; j<7; j++) {
     GetLocaleInfoA( LOCALE_USER_DEFAULT,LOCALE_SABBREVDAYNAME1 + (i +j)%7,
-            buf,sizeof(buf));
+		    buf,sizeof(buf));
     DrawTextA(hdc, buf, strlen(buf), days,
                          DT_CENTER | DT_VCENTER | DT_SINGLELINE );
@@ -530,8 +537,8 @@
 
 /* draw day numbers; first, the previous month */
-
+  
   firstDay = MONTHCAL_CalculateDayOfWeek(1, infoPtr->currentMonth, infoPtr->currentYear);
-
-  day = MONTHCAL_MonthLength(prevMonth, infoPtr->currentYear)  +
+  
+  day = MONTHCAL_MonthLength(prevMonth, infoPtr->currentYear)  + 
     (infoPtr->firstDay + 7  - firstDay)%7 + 1;
   if (day > MONTHCAL_MonthLength(prevMonth, infoPtr->currentYear))
@@ -546,5 +553,5 @@
     if(IntersectRect(&rcTemp, &(ps->rcPaint), &rcDay))
     {
-      MONTHCAL_DrawDay(hdc, infoPtr, day, prevMonth, i, 0,
+      MONTHCAL_DrawDay(hdc, infoPtr, day, prevMonth, i, 0, 
           infoPtr->monthdayState[m] & mask);
     }
@@ -570,12 +577,12 @@
     {
 
-      MONTHCAL_DrawDay(hdc, infoPtr, day, infoPtr->currentMonth, i, 0,
-    infoPtr->monthdayState[m] & mask);
+      MONTHCAL_DrawDay(hdc, infoPtr, day, infoPtr->currentMonth, i, 0, 
+	infoPtr->monthdayState[m] & mask);
 
       if((infoPtr->currentMonth==infoPtr->todaysDate.wMonth) &&
           (day==infoPtr->todaysDate.wDay) &&
-      (infoPtr->currentYear == infoPtr->todaysDate.wYear)) {
+	  (infoPtr->currentYear == infoPtr->todaysDate.wYear)) {
         if(!(dwStyle & MCS_NOTODAYCIRCLE))
-      MONTHCAL_CircleDay(hdc, infoPtr, day, infoPtr->currentMonth);
+	  MONTHCAL_CircleDay(hdc, infoPtr, day, infoPtr->currentMonth);
       }
     }
@@ -588,5 +595,5 @@
   j = 1; /* move to the 2nd week of the current month */
   i = 0; /* move back to sunday */
-  while(day <= MONTHCAL_MonthLength(infoPtr->currentMonth, infoPtr->currentYear)) {
+  while(day <= MONTHCAL_MonthLength(infoPtr->currentMonth, infoPtr->currentYear)) {	
     MONTHCAL_CalcDayRect(infoPtr, &rcDay, i, j);
     if(IntersectRect(&rcTemp, &(ps->rcPaint), &rcDay))
@@ -597,7 +604,7 @@
       if((infoPtr->currentMonth==infoPtr->todaysDate.wMonth) &&
           (day==infoPtr->todaysDate.wDay) &&
-          (infoPtr->currentYear == infoPtr->todaysDate.wYear))
-        if(!(dwStyle & MCS_NOTODAYCIRCLE))
-      MONTHCAL_CircleDay(hdc, infoPtr, day, infoPtr->currentMonth);
+          (infoPtr->currentYear == infoPtr->todaysDate.wYear)) 
+        if(!(dwStyle & MCS_NOTODAYCIRCLE))  
+	  MONTHCAL_CircleDay(hdc, infoPtr, day, infoPtr->currentMonth);
     }
     mask<<=1;
@@ -620,12 +627,12 @@
     MONTHCAL_CalcDayRect(infoPtr, &rcDay, i, j);
     if(IntersectRect(&rcTemp, &(ps->rcPaint), &rcDay))
-    {
+    {   
       MONTHCAL_DrawDay(hdc, infoPtr, day, infoPtr->currentMonth + 1, i, j,
-        infoPtr->monthdayState[m] & mask);
+		infoPtr->monthdayState[m] & mask);
     }
 
     mask<<=1;
     day++;
-    i++;
+    i++;	
     if(i==7) { /* past saturday, go to next week's sunday */
       i = 0;
@@ -643,13 +650,13 @@
     if(!(dwStyle & MCS_NOTODAYCIRCLE))  {
       /*day is the number of days from nextmonth we put on the calendar */
-      MONTHCAL_CircleDay(hdc, infoPtr,
-             day+MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear),
-             infoPtr->currentMonth);
+      MONTHCAL_CircleDay(hdc, infoPtr, 
+			 day+MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear), 
+			 infoPtr->currentMonth);
       offset+=textWidth;
     }
     if (!LoadStringA(COMCTL32_hModule,IDM_TODAY,buf1,sizeof(buf1)))
       {
-    WARN("Can't load resource\n");
-    strcpy(buf1,"Today:");
+	WARN("Can't load resource\n");
+	strcpy(buf1,"Today:");
       }
     MONTHCAL_CalcDayRect(infoPtr, &rtoday, 1, 6);
@@ -667,5 +674,5 @@
   }
 
-/*eventually draw week numbers*/
+/*eventually draw week numbers*/   
   if(dwStyle & MCS_WEEKNUMBERS)  {
     /* display weeknumbers*/
@@ -675,5 +682,5 @@
        LOCALE_IFIRSTWEEKOFYEAR == 0 (e.g US?):
        The week containing Jan 1 is the first week of year
-       LOCALE_IFIRSTWEEKOFYEAR == 2 (e.g. Germany):
+       LOCALE_IFIRSTWEEKOFYEAR == 2 (e.g. Germany): 
        First week of year must contain 4 days of the new year
        LOCALE_IFIRSTWEEKOFYEAR == 1  (what contries?)
@@ -681,44 +688,44 @@
     */
     GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_IFIRSTWEEKOFYEAR,
-             buf, sizeof(buf));
+		     buf, sizeof(buf));
     sscanf(buf, "%d", &weeknum);
     switch (weeknum)
       {
       case 1: mindays = 6;
-    break;
+	break;
       case 2: mindays = 3;
-    break;
+	break;
       case 0:
       default:
-    mindays = 0;
+	mindays = 0;
       }
     if (infoPtr->currentMonth < 2)
       {
-    /* calculate all those exceptions for january */
-    weeknum1=MONTHCAL_CalculateDayOfWeek(1,1,infoPtr->currentYear);
-    if ((infoPtr->firstDay +7 - weeknum1)%7 > mindays)
-        weeknum =1;
-    else
-      {
-        weeknum = 0;
-        for(i=0; i<11; i++)
-          weeknum+=MONTHCAL_MonthLength(i+1, infoPtr->currentYear-1);
-        weeknum +=startofprescal+ 7;
-        weeknum /=7;
-        weeknum1=MONTHCAL_CalculateDayOfWeek(1,1,infoPtr->currentYear-1);
-        if ((infoPtr->firstDay + 7 - weeknum1)%7 > mindays)
-          weeknum++;
-      }
+	/* calculate all those exceptions for january */
+	weeknum1=MONTHCAL_CalculateDayOfWeek(1,1,infoPtr->currentYear);
+	if ((infoPtr->firstDay +7 - weeknum1)%7 > mindays) 
+	    weeknum =1;
+	else
+	  {
+	    weeknum = 0;
+	    for(i=0; i<11; i++) 
+	      weeknum+=MONTHCAL_MonthLength(i+1, infoPtr->currentYear-1);
+	    weeknum +=startofprescal+ 7;
+	    weeknum /=7;
+	    weeknum1=MONTHCAL_CalculateDayOfWeek(1,1,infoPtr->currentYear-1);
+	    if ((infoPtr->firstDay + 7 - weeknum1)%7 > mindays)
+	      weeknum++;
+	  }
       }
     else
       {
-    weeknum = 0;
-    for(i=0; i<prevMonth-1; i++)
-      weeknum+=MONTHCAL_MonthLength(i+1, infoPtr->currentYear);
-    weeknum +=startofprescal+ 7;
-    weeknum /=7;
-    weeknum1=MONTHCAL_CalculateDayOfWeek(1,1,infoPtr->currentYear);
-    if ((infoPtr->firstDay + 7 - weeknum1)%7 > mindays)
-      weeknum++;
+	weeknum = 0;
+	for(i=0; i<prevMonth-1; i++) 
+	  weeknum+=MONTHCAL_MonthLength(i+1, infoPtr->currentYear);
+	weeknum +=startofprescal+ 7;
+	weeknum /=7;
+	weeknum1=MONTHCAL_CalculateDayOfWeek(1,1,infoPtr->currentYear);
+	if ((infoPtr->firstDay + 7 - weeknum1)%7 > mindays)
+	  weeknum++;
       }
     days->left = infoPtr->weeknums.left;
@@ -728,32 +735,32 @@
     for(i=0; i<6; i++) {
       if((i==0)&&(weeknum>50))
-    {
-      sprintf(buf, "%d", weeknum);
-      weeknum=0;
-    }
+	{
+	  sprintf(buf, "%d", weeknum);
+	  weeknum=0;
+	}
       else if((i==5)&&(weeknum>47))
-    {
-      sprintf(buf, "%d", 1);
-    }
+	{
+	  sprintf(buf, "%d", 1);
+	}
       else
-    sprintf(buf, "%d", weeknum + i);
+	sprintf(buf, "%d", weeknum + i);
       DrawTextA(hdc, buf, -1, days, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
       days->top+=infoPtr->height_increment;
       days->bottom+=infoPtr->height_increment;
     }
-
+			
     MoveToEx(hdc, infoPtr->weeknums.right, infoPtr->weeknums.top + 3 , NULL);
     LineTo(hdc,   infoPtr->weeknums.right, infoPtr->weeknums.bottom );
-
+		
   }
   /* currentFont was font at entering Refresh */
 
   SetBkColor(hdc, oldBkColor);
-  SelectObject(hdc, currentFont);
+  SelectObject(hdc, currentFont);     
   SetTextColor(hdc, oldTextColor);
 }
 
 
-static LRESULT
+static LRESULT 
 MONTHCAL_GetMinReqRect(HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
@@ -761,5 +768,5 @@
   LPRECT lpRect = (LPRECT) lParam;
   TRACE("%x %lx\n", wParam, lParam);
-
+	
   /* validate parameters */
 
@@ -774,5 +781,5 @@
 
 
-static LRESULT
+static LRESULT 
 MONTHCAL_GetColor(HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
@@ -800,5 +807,5 @@
 
 
-static LRESULT
+static LRESULT 
 MONTHCAL_SetColor(HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
@@ -840,5 +847,5 @@
 
 
-static LRESULT
+static LRESULT 
 MONTHCAL_GetMonthDelta(HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
@@ -846,5 +853,5 @@
 
   TRACE("%x %lx\n", wParam, lParam);
-
+  
   if(infoPtr->delta)
     return infoPtr->delta;
@@ -854,5 +861,5 @@
 
 
-static LRESULT
+static LRESULT 
 MONTHCAL_SetMonthDelta(HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
@@ -861,5 +868,5 @@
 
   TRACE("%x %lx\n", wParam, lParam);
-
+	
   infoPtr->delta = (int)wParam;
   return prev;
@@ -867,9 +874,9 @@
 
 
-static LRESULT
+static LRESULT 
 MONTHCAL_GetFirstDayOfWeek(HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
   MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
-
+	
   return infoPtr->firstDay;
 }
@@ -880,5 +887,5 @@
 /* FIXME: this needs to be implemented properly in MONTHCAL_Refresh() */
 /* FIXME: we need more error checking here */
-static LRESULT
+static LRESULT 
 MONTHCAL_SetFirstDayOfWeek(HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
@@ -896,10 +903,10 @@
     {
       GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_IFIRSTDAYOFWEEK,
-             buf, sizeof(buf));
+		     buf, sizeof(buf));
       TRACE("%s %d\n", buf, strlen(buf));
       if(sscanf(buf, "%d", &day) == 1)
-    infoPtr->firstDay = day;
+	infoPtr->firstDay = day;
       else
-    infoPtr->firstDay = 0;
+	infoPtr->firstDay = 0;
     }
   return prev;
@@ -909,5 +916,5 @@
 /* FIXME: fill this in */
 static LRESULT
-MONTHCAL_GetMonthRange(HWND hwnd, WPARAM wParam, LPARAM lParam)
+MONTHCAL_GetMonthRange(HWND hwnd, WPARAM wParam, LPARAM lParam) 
 {
   MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
@@ -930,5 +937,5 @@
 
 /* FIXME: are validated times taken from current date/time or simply
- * copied?
+ * copied? 
  * FIXME:    check whether MCM_GETMONTHRANGE shows correct result after
  *            adjusting range with MCM_SETRANGE
@@ -943,5 +950,5 @@
 
   TRACE("%x %lx\n", wParam, lParam);
-
+  
   if(wParam & GDTR_MAX) {
     if(MONTHCAL_ValidateTime(lprgSysTimeArray[1])){
@@ -966,7 +973,7 @@
   infoPtr->monthRange = infoPtr->maxDate.wMonth - infoPtr->minDate.wMonth;
 
-  if(infoPtr->monthRange!=prev) {
-    COMCTL32_ReAlloc(infoPtr->monthdayState,
-        infoPtr->monthRange * sizeof(MONTHDAYSTATE));
+  if(infoPtr->monthRange!=prev) { 
+	COMCTL32_ReAlloc(infoPtr->monthdayState, 
+		infoPtr->monthRange * sizeof(MONTHDAYSTATE));
   }
 
@@ -976,5 +983,5 @@
 
 /* CHECKME: At the moment, we copy ranges anyway,regardless of
- * infoPtr->rangeValid; a invalid range is simply filled with zeros in
+ * infoPtr->rangeValid; a invalid range is simply filled with zeros in 
  * SetRange.  Is this the right behavior?
 */
@@ -1008,10 +1015,10 @@
   if(iMonths!=infoPtr->monthRange) return 0;
 
-  for(i=0; i<iMonths; i++)
+  for(i=0; i<iMonths; i++) 
     infoPtr->monthdayState[i] = dayStates[i];
   return 1;
 }
 
-static LRESULT
+static LRESULT 
 MONTHCAL_GetCurSel(HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
@@ -1029,5 +1036,5 @@
 /* FIXME: if the specified date is not visible, make it visible */
 /* FIXME: redraw? */
-static LRESULT
+static LRESULT 
 MONTHCAL_SetCurSel(HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
@@ -1050,5 +1057,5 @@
 
 
-static LRESULT
+static LRESULT 
 MONTHCAL_GetMaxSelCount(HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
@@ -1060,5 +1067,5 @@
 
 
-static LRESULT
+static LRESULT 
 MONTHCAL_SetMaxSelCount(HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
@@ -1074,5 +1081,5 @@
 
 
-static LRESULT
+static LRESULT 
 MONTHCAL_GetSelRange(HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
@@ -1093,10 +1100,10 @@
     return TRUE;
   }
-
+ 
   return FALSE;
 }
 
 
-static LRESULT
+static LRESULT 
 MONTHCAL_SetSelRange(HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
@@ -1117,10 +1124,10 @@
     return TRUE;
   }
-
+ 
   return FALSE;
 }
 
 
-static LRESULT
+static LRESULT 
 MONTHCAL_GetToday(HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
@@ -1138,5 +1145,5 @@
 
 
-static LRESULT
+static LRESULT 
 MONTHCAL_SetToday(HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
@@ -1163,25 +1170,25 @@
   DWORD retval;
   int day,wday,wnum;
-
-
+  
+  
   x = lpht->pt.x;
   y = lpht->pt.y;
   retval = MCHT_NOWHERE;
-
-
-  /* Comment in for debugging...
-  TRACE("%d %d wd[%d %d %d %d] d[%d %d %d %d] t[%d %d %d %d] wn[%d %d %d %d]\n", x, y,
-    infoPtr->wdays.left, infoPtr->wdays.right,
-    infoPtr->wdays.top, infoPtr->wdays.bottom,
-    infoPtr->days.left, infoPtr->days.right,
-    infoPtr->days.top, infoPtr->days.bottom,
-    infoPtr->todayrect.left, infoPtr->todayrect.right,
-    infoPtr->todayrect.top, infoPtr->todayrect.bottom,
-    infoPtr->weeknums.left, infoPtr->weeknums.right,
-    infoPtr->weeknums.top, infoPtr->weeknums.bottom);
+  
+
+  /* Comment in for debugging... 
+  TRACE("%d %d wd[%d %d %d %d] d[%d %d %d %d] t[%d %d %d %d] wn[%d %d %d %d]\n", x, y, 
+	infoPtr->wdays.left, infoPtr->wdays.right,
+	infoPtr->wdays.top, infoPtr->wdays.bottom,
+	infoPtr->days.left, infoPtr->days.right,
+	infoPtr->days.top, infoPtr->days.bottom,
+	infoPtr->todayrect.left, infoPtr->todayrect.right,
+	infoPtr->todayrect.top, infoPtr->todayrect.bottom,
+	infoPtr->weeknums.left, infoPtr->weeknums.right,
+	infoPtr->weeknums.top, infoPtr->weeknums.bottom);
   */
 
   /* are we in the header? */
-
+  
   if(PtInRect(&infoPtr->title, lpht->pt)) {
     if(PtInRect(&infoPtr->titlebtnprev, lpht->pt)) {
@@ -1201,9 +1208,9 @@
       goto done;
     }
-
+    
     retval = MCHT_TITLE;
     goto done;
   }
-
+  
   day = MONTHCAL_CalcDayFromPos(infoPtr,x,y,&wday,&wnum);
   if(PtInRect(&infoPtr->wdays, lpht->pt)) {
@@ -1211,62 +1218,62 @@
     lpht->st.wYear  = infoPtr->currentYear;
     lpht->st.wMonth = (day < 1)? infoPtr->currentMonth -1 : infoPtr->currentMonth;
-    lpht->st.wDay   = (day < 1)?
+    lpht->st.wDay   = (day < 1)? 
       MONTHCAL_MonthLength(infoPtr->currentMonth-1,infoPtr->currentYear) -day : day;
     goto done;
   }
-  if(PtInRect(&infoPtr->weeknums, lpht->pt)) {
-    retval = MCHT_CALENDARWEEKNUM;
+  if(PtInRect(&infoPtr->weeknums, lpht->pt)) {  
+    retval = MCHT_CALENDARWEEKNUM; 
     lpht->st.wYear  = infoPtr->currentYear;
-    lpht->st.wMonth = (day < 1) ? infoPtr->currentMonth -1 :
-      (day > MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear)) ?
+    lpht->st.wMonth = (day < 1) ? infoPtr->currentMonth -1 : 
+      (day > MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear)) ? 
       infoPtr->currentMonth +1 :infoPtr->currentMonth;
-    lpht->st.wDay   = (day < 1 ) ?
-      MONTHCAL_MonthLength(infoPtr->currentMonth-1,infoPtr->currentYear) -day :
-      (day > MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear)) ?
+    lpht->st.wDay   = (day < 1 ) ? 
+      MONTHCAL_MonthLength(infoPtr->currentMonth-1,infoPtr->currentYear) -day : 
+      (day > MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear)) ? 
       day - MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear) : day;
-    goto done;
-  }
-  if(PtInRect(&infoPtr->days, lpht->pt))
+    goto done;				    
+  }
+  if(PtInRect(&infoPtr->days, lpht->pt)) 
     {
       lpht->st.wYear  = infoPtr->currentYear;
-      if ( day < 1)
-    {
-      retval = MCHT_CALENDARDATEPREV;
-      lpht->st.wMonth = infoPtr->currentMonth - 1;
-      if (lpht->st.wMonth <1)
-        {
-          lpht->st.wMonth = 12;
-          lpht->st.wYear--;
-        }
-      lpht->st.wDay   = MONTHCAL_MonthLength(lpht->st.wMonth,lpht->st.wYear) -day;
-    }
+      if ( day < 1) 
+	{
+	  retval = MCHT_CALENDARDATEPREV;
+	  lpht->st.wMonth = infoPtr->currentMonth - 1;
+	  if (lpht->st.wMonth <1)
+	    {
+	      lpht->st.wMonth = 12;
+	      lpht->st.wYear--;
+	    }
+	  lpht->st.wDay   = MONTHCAL_MonthLength(lpht->st.wMonth,lpht->st.wYear) -day;
+	}
       else if (day > MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear))
-    {
-      retval = MCHT_CALENDARDATENEXT;
-      lpht->st.wMonth = infoPtr->currentMonth + 1;
-      if (lpht->st.wMonth <12)
-        {
-          lpht->st.wMonth = 1;
-          lpht->st.wYear++;
-        }
-      lpht->st.wDay   = day - MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear) ;
-    }
+	{
+	  retval = MCHT_CALENDARDATENEXT;
+	  lpht->st.wMonth = infoPtr->currentMonth + 1;
+	  if (lpht->st.wMonth <12)
+	    {
+	      lpht->st.wMonth = 1;
+	      lpht->st.wYear++;
+	    }
+	  lpht->st.wDay   = day - MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear) ;
+	}
       else {
-    retval = MCHT_CALENDARDATE;
-    lpht->st.wMonth = infoPtr->currentMonth;
-    lpht->st.wDay   = day;
+	retval = MCHT_CALENDARDATE;
+	lpht->st.wMonth = infoPtr->currentMonth;
+	lpht->st.wDay   = day;
       }
       goto done;
     }
   if(PtInRect(&infoPtr->todayrect, lpht->pt)) {
-    retval = MCHT_TODAYLINK;
+    retval = MCHT_TODAYLINK; 
     goto done;
   }
-
-
+  
+  
   /* Hit nothing special? What's left must be background :-) */
-
-  retval = MCHT_CALENDARBK;
- done:
+  
+  retval = MCHT_CALENDARBK;       
+ done: 
   lpht->uHit = retval;
   return retval;
@@ -1293,6 +1300,6 @@
     nmds.nmhdr.idFrom   = GetWindowLongA(hwnd, GWL_ID);
     nmds.nmhdr.code     = MCN_GETDAYSTATE;
-    nmds.cDayState  = infoPtr->monthRange;
-    nmds.prgDayState    = COMCTL32_Alloc(infoPtr->monthRange * sizeof(MONTHDAYSTATE));
+    nmds.cDayState	= infoPtr->monthRange;
+    nmds.prgDayState	= COMCTL32_Alloc(infoPtr->monthRange * sizeof(MONTHDAYSTATE));
 
     SendMessageA(GetParent(hwnd), WM_NOTIFY,
@@ -1323,6 +1330,6 @@
     nmds.nmhdr.idFrom   = GetWindowLongA(hwnd, GWL_ID);
     nmds.nmhdr.code     = MCN_GETDAYSTATE;
-    nmds.cDayState  = infoPtr->monthRange;
-    nmds.prgDayState    = COMCTL32_Alloc
+    nmds.cDayState	= infoPtr->monthRange;
+    nmds.prgDayState	= COMCTL32_Alloc 
                         (infoPtr->monthRange * sizeof(MONTHDAYSTATE));
 
@@ -1341,5 +1348,5 @@
   POINT menupoint;
   char buf[32];
-
+  
   hMenu = CreatePopupMenu();
   if (!LoadStringA(COMCTL32_hModule,IDM_GOTODAY,buf,sizeof(buf)))
@@ -1353,10 +1360,10 @@
   ClientToScreen(hwnd, &menupoint);
   if( TrackPopupMenu(hMenu,TPM_RIGHTBUTTON| TPM_NONOTIFY|TPM_RETURNCMD,
-             menupoint.x,menupoint.y,0,hwnd,NULL))
+		     menupoint.x,menupoint.y,0,hwnd,NULL))
     {
       infoPtr->currentMonth=infoPtr->todaysDate.wMonth;
       infoPtr->currentYear=infoPtr->todaysDate.wYear;
       InvalidateRect(hwnd, NULL, FALSE);
-    }
+    }	
   return 0;
 }
@@ -1374,23 +1381,23 @@
   POINT menupoint;
   TRACE("%x %lx\n", wParam, lParam);
-
+	
   if (infoPtr->hWndYearUpDown)
     {
       infoPtr->currentYear=SendMessageA( infoPtr->hWndYearUpDown, UDM_SETPOS,   (WPARAM) 0,(LPARAM)0);
       if(!DestroyWindow(infoPtr->hWndYearUpDown))
-    {
-      FIXME("Can't destroy Updown Control\n");
-    }
+	{
+	  FIXME("Can't destroy Updown Control\n");
+	}
       else
-    infoPtr->hWndYearUpDown=0;
+	infoPtr->hWndYearUpDown=0;
       if(!DestroyWindow(infoPtr->hWndYearEdit))
-    {
-      FIXME("Can't destroy Updown Control\n");
-    }
+	{
+	  FIXME("Can't destroy Updown Control\n");
+	}
       else
-    infoPtr->hWndYearEdit=0;
+	infoPtr->hWndYearEdit=0;
       InvalidateRect(hwnd, NULL, FALSE);
     }
-
+  
   ht.pt.x = (INT)LOWORD(lParam);
   ht.pt.y = (INT)HIWORD(lParam);
@@ -1407,5 +1414,5 @@
     return TRUE;
   }
-  if(hit == MCHT_TITLEBTNPREV){
+  if(hit == MCHT_TITLEBTNPREV){ 
     MONTHCAL_GoToPrevMonth(hwnd, infoPtr);
     infoPtr->status = MC_PREVPRESSED;
@@ -1417,10 +1424,10 @@
   if(hit == MCHT_TITLEMONTH) {
     hMenu = CreatePopupMenu();
-
+    
     for (i=0; i<12;i++)
       {
-    GetLocaleInfoA( LOCALE_USER_DEFAULT,LOCALE_SMONTHNAME1+i,
-          buf,sizeof(buf));
-    AppendMenuA(hMenu, MF_STRING|MF_ENABLED,i+1, buf);
+	GetLocaleInfoA( LOCALE_USER_DEFAULT,LOCALE_SMONTHNAME1+i,
+		  buf,sizeof(buf));
+	AppendMenuA(hMenu, MF_STRING|MF_ENABLED,i+1, buf);
       }
     menupoint.x=infoPtr->titlemonth.right;
@@ -1428,39 +1435,39 @@
     ClientToScreen(hwnd, &menupoint);
     i= TrackPopupMenu(hMenu,TPM_LEFTALIGN | TPM_NONOTIFY | TPM_RIGHTBUTTON | TPM_RETURNCMD,
-              menupoint.x,menupoint.y,0,hwnd,NULL);
+		      menupoint.x,menupoint.y,0,hwnd,NULL);
     if ((i>0) && (i<13))
       {
-    infoPtr->currentMonth=i;
-    InvalidateRect(hwnd, NULL, FALSE);
+	infoPtr->currentMonth=i;
+	InvalidateRect(hwnd, NULL, FALSE);
       }
   }
   if(hit == MCHT_TITLEYEAR) {
     infoPtr->hWndYearEdit=CreateWindowExA(0,
-             "EDIT",
-               0,
-             WS_VISIBLE | WS_CHILD |UDS_SETBUDDYINT,
-             infoPtr->titleyear.left+3,infoPtr->titlebtnnext.top,
-             infoPtr->titleyear.right-infoPtr->titleyear.left,
-             infoPtr->textHeight,
-             hwnd,
-             (HMENU)NULL,
-             (HINSTANCE)NULL,
-             NULL);
+			 "EDIT",
+			   0,
+			 WS_VISIBLE | WS_CHILD |UDS_SETBUDDYINT,
+			 infoPtr->titleyear.left+3,infoPtr->titlebtnnext.top,
+			 infoPtr->titleyear.right-infoPtr->titleyear.left,
+			 infoPtr->textHeight,
+			 hwnd,
+			 (HMENU)NULL, 
+			 (HINSTANCE)NULL, 
+			 NULL);
     infoPtr->hWndYearUpDown=CreateWindowExA(0,
-             UPDOWN_CLASSA,
-               0,
-             WS_VISIBLE | WS_CHILD |UDS_SETBUDDYINT|UDS_NOTHOUSANDS|UDS_ARROWKEYS,
-             infoPtr->titleyear.right+6,infoPtr->titlebtnnext.top,
-             20,
-             infoPtr->textHeight,
-             hwnd,
-             (HMENU)NULL,
-             (HINSTANCE)NULL,
-             NULL);
+			 UPDOWN_CLASSA,
+			   0,
+			 WS_VISIBLE | WS_CHILD |UDS_SETBUDDYINT|UDS_NOTHOUSANDS|UDS_ARROWKEYS,
+			 infoPtr->titleyear.right+6,infoPtr->titlebtnnext.top,
+			 20,
+			 infoPtr->textHeight,
+			 hwnd,
+			 (HMENU)NULL, 
+			 (HINSTANCE)NULL, 
+			 NULL);
     SendMessageA( infoPtr->hWndYearUpDown, UDM_SETRANGE, (WPARAM) 0, MAKELONG (9999, 1753));
     SendMessageA( infoPtr->hWndYearUpDown, UDM_SETBUDDY, (WPARAM) infoPtr->hWndYearEdit, (LPARAM)0 );
     SendMessageA( infoPtr->hWndYearUpDown, UDM_SETPOS,   (WPARAM) 0,(LPARAM)infoPtr->currentYear );
     return TRUE;
-
+	 
   }
   if(hit == MCHT_TODAYLINK) {
@@ -1480,5 +1487,5 @@
     MONTHCAL_CopyTime(&nmsc.stSelStart, &infoPtr->minSel);
     MONTHCAL_CopyTime(&nmsc.stSelEnd, &infoPtr->maxSel);
-
+	
     SendMessageA(GetParent(hwnd), WM_NOTIFY,
            (WPARAM)nmsc.nmhdr.idFrom,(LPARAM)&nmsc);
@@ -1486,5 +1493,5 @@
     MONTHCAL_CopyTime(&ht.st, &selArray[0]);
     MONTHCAL_CopyTime(&ht.st, &selArray[1]);
-    MONTHCAL_SetSelRange(hwnd,0,(LPARAM) &selArray);
+    MONTHCAL_SetSelRange(hwnd,0,(LPARAM) &selArray); 
 
     /* redraw both old and new days if the selected day changed */
@@ -1539,5 +1546,5 @@
     return TRUE;
   }
-  if(hit == MCHT_CALENDARDATEPREV){
+  if(hit == MCHT_CALENDARDATEPREV){ 
     MONTHCAL_GoToPrevMonth(hwnd, infoPtr);
     InvalidateRect(hwnd, NULL, FALSE);
@@ -1557,12 +1564,12 @@
   MONTHCAL_CopyTime(&nmsc.stSelStart, &infoPtr->minSel);
   MONTHCAL_CopyTime(&nmsc.stSelEnd, &infoPtr->maxSel);
-
+	
   SendMessageA(GetParent(hwnd), WM_NOTIFY,
            (WPARAM)nmsc.nmhdr.idFrom, (LPARAM)&nmsc);
-
+  
   /* redraw if necessary */
   if(redraw)
     InvalidateRect(hwnd, NULL, FALSE);
-
+	
   return 0;
 }
@@ -1579,5 +1586,5 @@
 
   switch(wParam) {
-  case MC_NEXTMONTHTIMER:
+  case MC_NEXTMONTHTIMER: 
     redraw = TRUE;
     MONTHCAL_GoToNextMonth(hwnd, infoPtr);
@@ -1611,7 +1618,7 @@
   ht.pt.x = LOWORD(lParam);
   ht.pt.y = HIWORD(lParam);
-
+	
   hit = MONTHCAL_HitTest(hwnd, (LPARAM)&ht);
-
+  
   /* not on the calendar date numbers? bail out */
   TRACE("hit:%x\n",hit);
@@ -1631,5 +1638,5 @@
     if(infoPtr->firstSelDay==selArray[0].wDay) i=1;
     TRACE("oldRange:%d %d %d %d\n", infoPtr->firstSelDay, selArray[0].wDay, selArray[1].wDay, i);
-    if(infoPtr->firstSelDay==selArray[1].wDay) {
+    if(infoPtr->firstSelDay==selArray[1].wDay) {  
       /* 1st time we get here: selArray[0]=selArray[1])  */
       /* if we're still at the first selected date, return */
@@ -1637,5 +1644,5 @@
       if(selday<infoPtr->firstSelDay) i = 0;
     }
-
+			
     if(abs(infoPtr->firstSelDay - selday) >= infoPtr->maxSelCount) {
       if(selday>infoPtr->firstSelDay)
@@ -1644,8 +1651,8 @@
         selday = infoPtr->firstSelDay - infoPtr->maxSelCount;
     }
-
+		
     if(selArray[i].wDay!=selday) {
       TRACE("newRange:%d %d %d %d\n", infoPtr->firstSelDay, selArray[0].wDay, selArray[1].wDay, i);
-
+			
       selArray[i].wDay = selday;
 
@@ -1705,5 +1712,5 @@
 {
   TRACE("\n");
-
+  
   InvalidateRect(hwnd, NULL, FALSE);
 
@@ -1762,6 +1769,6 @@
 
   /* recalculate the height and width increments and offsets */
-  /* FIXME: We use up all available width. This will inhibit having multiple
-     calendars in a row, like win doesn
+  /* FIXME: We use up all available width. This will inhibit having multiple 
+     calendars in a row, like win doesn 
   */
   if(dwStyle & MCS_WEEKNUMBERS)
@@ -1769,6 +1776,6 @@
   else
     xdiv=7.0;
-  infoPtr->width_increment = (infoPtr->rcDraw.right - infoPtr->rcDraw.left) / xdiv;
-  infoPtr->height_increment = (infoPtr->rcDraw.bottom - infoPtr->rcDraw.top) / 10.0;
+  infoPtr->width_increment = (infoPtr->rcDraw.right - infoPtr->rcDraw.left) / xdiv; 
+  infoPtr->height_increment = (infoPtr->rcDraw.bottom - infoPtr->rcDraw.top) / 10.0; 
   infoPtr->left_offset = (infoPtr->rcDraw.right - infoPtr->rcDraw.left) - (infoPtr->width_increment * xdiv);
   infoPtr->top_offset = (infoPtr->rcDraw.bottom - infoPtr->rcDraw.top) - (infoPtr->height_increment * 10.0);
@@ -1783,5 +1790,5 @@
     rcDraw->bottom = rcDraw->top + 9 * infoPtr->textHeight + 5;
     }*/
-
+   
   /* calculate title area */
   title->top    = rcClient->top;
@@ -1798,5 +1805,5 @@
   next->right  = title->right - 6;
   next->left   = next->right - (title->bottom - title->top);
-
+  
   /* titlemonth->left and right change based upon the current month */
   /* and are recalculated in refresh as the current month may change */
@@ -1804,9 +1811,9 @@
   titlemonth->top    = titleyear->top    = title->top    + (infoPtr->height_increment)/2;
   titlemonth->bottom = titleyear->bottom = title->bottom - (infoPtr->height_increment)/2;
-
+  
   /* setup the dimensions of the rectangle we draw the names of the */
   /* days of the week in */
   weeknumrect->left =infoPtr->left_offset;
-  if(dwStyle & MCS_WEEKNUMBERS)
+  if(dwStyle & MCS_WEEKNUMBERS)  
     weeknumrect->right=prev->right;
   else
@@ -1816,8 +1823,8 @@
   wdays->top    = title->bottom ;
   wdays->bottom = wdays->top + infoPtr->height_increment;
-
+  
   days->top    = weeknumrect->top = wdays->bottom ;
   days->bottom = weeknumrect->bottom = days->top     + 6 * infoPtr->height_increment;
-
+  
   todayrect->left   = rcClient->left;
   todayrect->right  = rcClient->right;
@@ -1825,16 +1832,16 @@
   todayrect->bottom = days->bottom + infoPtr->height_increment;
 
-  /* uncomment for excessive debugging
+  /* uncomment for excessive debugging 
   TRACE("dx=%d dy=%d rcC[%d %d %d %d] t[%d %d %d %d] wd[%d %d %d %d] w[%d %d %d %d] t[%d %d %d %d]\n",
-    infoPtr->width_increment,infoPtr->height_increment,
-     rcClient->left, rcClient->right, rcClient->top, rcClient->bottom,
-        title->left,    title->right,    title->top,    title->bottom,
-        wdays->left,    wdays->right,    wdays->top,    wdays->bottom,
-         days->left,     days->right,     days->top,     days->bottom,
-    todayrect->left,todayrect->right,todayrect->top,todayrect->bottom);
+	infoPtr->width_increment,infoPtr->height_increment,
+	 rcClient->left, rcClient->right, rcClient->top, rcClient->bottom,
+	    title->left,    title->right,    title->top,    title->bottom,
+	    wdays->left,    wdays->right,    wdays->top,    wdays->bottom,
+	     days->left,     days->right,     days->top,     days->bottom,
+	todayrect->left,todayrect->right,todayrect->top,todayrect->bottom);
   */
-
+  
   /* restore the originally selected font */
-  SelectObject(hdc, currentFont);
+  SelectObject(hdc, currentFont);     
 
   ReleaseDC(hwnd, hdc);
@@ -1858,8 +1865,12 @@
 {
   MONTHCAL_INFO *infoPtr;
-  LOGFONTA  logFont;
+  LOGFONTA	logFont;
 
   /* allocate memory for info structure */
+#ifdef __WIN32OS2__
+  infoPtr =(MONTHCAL_INFO*)initControl(hwnd,sizeof(MONTHCAL_INFO));
+#else
   infoPtr =(MONTHCAL_INFO*)COMCTL32_Alloc(sizeof(MONTHCAL_INFO));
+#endif
   SetWindowLongA(hwnd, 0, (DWORD)infoPtr);
 
@@ -1889,5 +1900,5 @@
   infoPtr->maxSelCount  = 7;
   infoPtr->monthRange = 3;
-  infoPtr->monthdayState = COMCTL32_Alloc
+  infoPtr->monthdayState = COMCTL32_Alloc 
                          (infoPtr->monthRange * sizeof(MONTHDAYSTATE));
   infoPtr->titlebk     = GetSysColor(COLOR_ACTIVECAPTION);
@@ -1896,5 +1907,5 @@
   infoPtr->trailingtxt = GetSysColor(COLOR_GRAYTEXT);
   infoPtr->bk          = GetSysColor(COLOR_WINDOW);
-  infoPtr->txt         = GetSysColor(COLOR_WINDOWTEXT);
+  infoPtr->txt	       = GetSysColor(COLOR_WINDOWTEXT);
 
   /* call MONTHCAL_UpdateSize to set all of the dimensions */
@@ -2051,5 +2062,5 @@
   wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
   wndClass.lpszClassName = MONTHCAL_CLASSA;
-
+ 
   RegisterClassA(&wndClass);
 }
Index: trunk/src/comctl32/nativefont.cpp
===================================================================
--- trunk/src/comctl32/nativefont.cpp	(revision 5413)
+++ trunk/src/comctl32/nativefont.cpp	(revision 5416)
@@ -1,3 +1,3 @@
-/* $Id: nativefont.cpp,v 1.3 2000-03-21 17:30:43 cbratschi Exp $ */
+/* $Id: nativefont.cpp,v 1.4 2001-03-31 13:25:26 sandervl Exp $ */
 /*
  * Native Font control
@@ -21,4 +21,5 @@
 #include "ccbase.h"
 #include "nativefont.h"
+#include "comctl32.h"
 
 #define NATIVEFONT_GetInfoPtr(hwnd) ((NATIVEFONT_INFO*)getInfoPtr(hwnd))
Index: trunk/src/comctl32/pager.c
===================================================================
--- trunk/src/comctl32/pager.c	(revision 5416)
+++ trunk/src/comctl32/pager.c	(revision 5416)
@@ -0,0 +1,1242 @@
+/*
+ * Pager control
+ *
+ * Copyright 1998, 1999 Eric Kohl
+ *
+ * NOTES
+ *    Tested primarily with the controlspy Pager application.
+ *       Susan Farley (susan@codeweavers.com)
+ *
+ * TODO:
+ *    Implement repetitive button press.
+ *    Adjust arrow size relative to size of button.
+ *    Allow border size changes.
+ *    Implement drag and drop style.
+ */
+
+#include <string.h>
+#include "winbase.h"
+#include "commctrl.h"
+#include "debugtools.h"
+
+#ifdef __WIN32OS2__
+#include "ccbase.h"
+#define inline
+#endif
+
+DEFAULT_DEBUG_CHANNEL(pager);
+
+typedef struct
+{
+#ifdef __WIN32OS2__
+    COMCTL32_HEADER header;
+#endif
+    HWND   hwndChild;  /* handle of the contained wnd */
+    BOOL   bNoResize;  /* set when created with CCS_NORESIZE */
+    COLORREF clrBk;    /* background color */
+    INT    nBorder;    /* border size for the control */
+    INT    nButtonSize;/* size of the pager btns */
+    INT    nPos;       /* scroll position */
+    INT    nWidth;     /* from child wnd's response to PGN_CALCSIZE */
+    INT    nHeight;    /* from child wnd's response to PGN_CALCSIZE */ 
+    BOOL   bForward;   /* forward WM_MOUSEMOVE msgs to the contained wnd */
+    INT    TLbtnState; /* state of top or left btn */
+    INT    BRbtnState; /* state of bottom or right btn */
+
+} PAGER_INFO;
+
+#define PAGER_GetInfoPtr(hwnd) ((PAGER_INFO *)GetWindowLongA(hwnd, 0))
+#define PAGER_IsHorizontal(hwnd) ((GetWindowLongA (hwnd, GWL_STYLE) & PGS_HORZ))
+
+#define MIN_ARROW_WIDTH  8
+#define MIN_ARROW_HEIGHT 5
+
+
+/* the horizontal arrows are: 
+ *
+ * 01234    01234
+ * 1  *      *
+ * 2 **      **
+ * 3***      ***
+ * 4***      ***
+ * 5 **      **
+ * 6  *      *
+ * 7  
+ *
+ */
+static void
+PAGER_DrawHorzArrow (HDC hdc, RECT r, INT colorRef, BOOL left)
+{
+    INT x, y, w, h;
+    HPEN hOldPen;
+    
+    w = r.right - r.left + 1;
+    h = r.bottom - r.top + 1;
+    if ((h < MIN_ARROW_WIDTH) || (w < MIN_ARROW_HEIGHT))
+        return;  /* refuse to draw partial arrow */
+
+    hOldPen = SelectObject ( hdc, GetSysColorPen (colorRef));
+    if (left)
+    {
+        x = r.left + ((w - MIN_ARROW_HEIGHT) / 2) + 3;
+        y = r.top + ((h - MIN_ARROW_WIDTH) / 2) + 1;
+        MoveToEx (hdc, x, y, NULL);
+        LineTo (hdc, x--, y+5); y++;
+        MoveToEx (hdc, x, y, NULL);
+        LineTo (hdc, x--, y+3); y++;
+        MoveToEx (hdc, x, y, NULL);
+        LineTo (hdc, x, y+1);
+    }
+    else
+    {
+        x = r.left + ((w - MIN_ARROW_HEIGHT) / 2) + 1;
+        y = r.top + ((h - MIN_ARROW_WIDTH) / 2) + 1;
+        MoveToEx (hdc, x, y, NULL);
+        LineTo (hdc, x++, y+5); y++;
+        MoveToEx (hdc, x, y, NULL);
+        LineTo (hdc, x++, y+3); y++;
+        MoveToEx (hdc, x, y, NULL);
+        LineTo (hdc, x, y+1);
+    }
+
+    SelectObject( hdc, hOldPen );
+}
+
+/* the vertical arrows are: 
+ *
+ * 01234567    01234567
+ * 1******        **  
+ * 2 ****        ****
+ * 3  **        ******
+ * 4
+ *
+ */
+static void
+PAGER_DrawVertArrow (HDC hdc, RECT r, INT colorRef, BOOL up)
+{
+    INT x, y, w, h;
+    HPEN hOldPen;
+    
+    w = r.right - r.left + 1;
+    h = r.bottom - r.top + 1;
+    if ((h < MIN_ARROW_WIDTH) || (w < MIN_ARROW_HEIGHT))
+        return;  /* refuse to draw partial arrow */
+
+    hOldPen = SelectObject ( hdc, GetSysColorPen (colorRef));
+    if (up)
+    {
+        x = r.left + ((w - MIN_ARROW_HEIGHT) / 2) + 1;
+        y = r.top + ((h - MIN_ARROW_WIDTH) / 2) + 3;
+        MoveToEx (hdc, x, y, NULL);
+        LineTo (hdc, x+5, y--); x++;
+        MoveToEx (hdc, x, y, NULL);
+        LineTo (hdc, x+3, y--); x++;
+        MoveToEx (hdc, x, y, NULL);
+        LineTo (hdc, x+1, y);
+    }
+    else
+    {
+        x = r.left + ((w - MIN_ARROW_HEIGHT) / 2) + 1;
+        y = r.top + ((h - MIN_ARROW_WIDTH) / 2) + 1;
+        MoveToEx (hdc, x, y, NULL);
+        LineTo (hdc, x+5, y++); x++;
+        MoveToEx (hdc, x, y, NULL);
+        LineTo (hdc, x+3, y++); x++;
+        MoveToEx (hdc, x, y, NULL);
+        LineTo (hdc, x+1, y);
+    }
+
+    SelectObject( hdc, hOldPen );
+}
+
+static void
+PAGER_DrawButton(HDC hdc, COLORREF clrBk, RECT arrowRect,
+                 BOOL horz, BOOL topLeft, INT btnState)
+{
+    HBRUSH   hBrush, hOldBrush;
+    RECT     rc = arrowRect;
+
+    if (!btnState) /* PGF_INVISIBLE */
+        return;
+
+    if ((rc.right - rc.left <= 0) || (rc.bottom - rc.top <= 0))
+        return;  
+
+    hBrush = CreateSolidBrush(clrBk);
+    hOldBrush = (HBRUSH)SelectObject(hdc, hBrush);
+
+    FillRect(hdc, &rc, hBrush);
+
+    if (btnState == PGF_HOT) 
+    {
+       rc.left++, rc.top++; rc.right++, rc.bottom++;
+       DrawEdge( hdc, &rc, EDGE_RAISED, BF_RECT);
+       if (horz)
+           PAGER_DrawHorzArrow(hdc, rc, COLOR_WINDOWFRAME, topLeft);
+       else
+           PAGER_DrawVertArrow(hdc, rc, COLOR_WINDOWFRAME, topLeft);
+       rc.left--, rc.top--; rc.right--, rc.bottom--;
+    }
+    else if (btnState == PGF_NORMAL) 
+    {
+       DrawEdge (hdc, &rc, BDR_OUTER, BF_FLAT);
+       if (horz)
+           PAGER_DrawHorzArrow(hdc, rc, COLOR_WINDOWFRAME, topLeft);
+       else
+           PAGER_DrawVertArrow(hdc, rc, COLOR_WINDOWFRAME, topLeft);
+    }
+    else if (btnState == PGF_DEPRESSED) 
+    {
+       rc.left++, rc.top++;
+       DrawEdge( hdc, &rc, BDR_SUNKENOUTER, BF_RECT);
+       if (horz)
+           PAGER_DrawHorzArrow(hdc, rc, COLOR_WINDOWFRAME, topLeft);
+       else
+           PAGER_DrawVertArrow(hdc, rc, COLOR_WINDOWFRAME, topLeft);
+       rc.left--, rc.top--;
+    }
+    else if (btnState == PGF_GRAYED) 
+    {
+       DrawEdge (hdc, &rc, BDR_OUTER, BF_FLAT);
+       if (horz)
+       {
+           PAGER_DrawHorzArrow(hdc, rc, COLOR_3DHIGHLIGHT, topLeft);
+           rc.left++, rc.top++; rc.right++, rc.bottom++;
+           PAGER_DrawHorzArrow(hdc, rc, COLOR_3DSHADOW, topLeft);
+       }
+       else
+       {
+           PAGER_DrawVertArrow(hdc, rc, COLOR_3DHIGHLIGHT, topLeft);
+           rc.left++, rc.top++; rc.right++, rc.bottom++;
+           PAGER_DrawVertArrow(hdc, rc, COLOR_3DSHADOW, topLeft);
+       }
+       rc.left--, rc.top--; rc.right--, rc.bottom--;
+    }
+
+    SelectObject( hdc, hOldBrush );
+    DeleteObject(hBrush);
+}
+
+/* << PAGER_GetDropTarget >> */
+
+static inline LRESULT
+PAGER_ForwardMouse (HWND hwnd, WPARAM wParam)
+{
+    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
+    TRACE("[%04x]\n", hwnd);
+
+    infoPtr->bForward = (BOOL)wParam;
+
+    return 0;
+}
+
+static inline LRESULT
+PAGER_GetButtonState (HWND hwnd, WPARAM wParam, LPARAM lParam)
+{
+    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); 
+    LRESULT btnState = PGF_INVISIBLE;
+    INT btn = (INT)lParam;
+    TRACE("[%04x]\n", hwnd);
+
+    if (btn == PGB_TOPORLEFT)
+        btnState = infoPtr->TLbtnState;
+    else if (btn == PGB_BOTTOMORRIGHT)
+        btnState = infoPtr->BRbtnState;
+
+    return btnState;
+}
+
+
+static inline LRESULT
+PAGER_GetPos(HWND hwnd)
+{
+    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); 
+    TRACE("[%04x] returns %d\n", hwnd, infoPtr->nPos);
+    return (LRESULT)infoPtr->nPos;
+}
+
+static inline LRESULT
+PAGER_GetButtonSize(HWND hwnd)
+{
+    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); 
+    TRACE("[%04x] returns %d\n", hwnd, infoPtr->nButtonSize);
+    return (LRESULT)infoPtr->nButtonSize;
+}
+
+static inline LRESULT
+PAGER_GetBorder(HWND hwnd)
+{
+    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); 
+    TRACE("[%04x] returns %d\n", hwnd, infoPtr->nBorder);
+    return (LRESULT)infoPtr->nBorder;
+}
+
+static inline LRESULT
+PAGER_GetBkColor(HWND hwnd)
+{
+    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); 
+    TRACE("[%04x] returns %06lx\n", hwnd, infoPtr->clrBk);
+    return (LRESULT)infoPtr->clrBk;
+}
+
+static void 
+PAGER_CalcSize (HWND hwnd, INT* size, BOOL getWidth) 
+{
+    NMPGCALCSIZE nmpgcs;
+    ZeroMemory (&nmpgcs, sizeof (NMPGCALCSIZE));
+    nmpgcs.hdr.hwndFrom = hwnd;
+    nmpgcs.hdr.idFrom   = GetWindowLongA (hwnd, GWL_ID);
+    nmpgcs.hdr.code = PGN_CALCSIZE;
+    nmpgcs.dwFlag = getWidth ? PGF_CALCWIDTH : PGF_CALCHEIGHT;
+    nmpgcs.iWidth = getWidth ? *size : 0;
+    nmpgcs.iHeight = getWidth ? 0 : *size;
+    SendMessageA (hwnd, WM_NOTIFY,
+                  (WPARAM)nmpgcs.hdr.idFrom, (LPARAM)&nmpgcs);
+
+    *size = getWidth ? nmpgcs.iWidth : nmpgcs.iHeight;
+
+    TRACE("[%04x] PGN_CALCSIZE returns %s=%d\n", hwnd,
+                  getWidth ? "width" : "height", *size);
+}
+
+static void
+PAGER_PositionChildWnd(HWND hwnd, PAGER_INFO* infoPtr)
+{
+    if (infoPtr->hwndChild)
+    {
+        RECT rcClient;
+        int nPos = infoPtr->nPos;
+
+        /* compensate for a grayed btn, which will soon become invisible */
+        if (infoPtr->TLbtnState == PGF_GRAYED)
+            nPos += infoPtr->nButtonSize;
+
+        GetClientRect(hwnd, &rcClient);
+
+        if (PAGER_IsHorizontal(hwnd))
+        {
+            int wndSize = max(0, rcClient.right - rcClient.left);
+            if (infoPtr->nWidth < wndSize)
+                infoPtr->nWidth = wndSize;
+
+            TRACE("[%04x] SWP %dx%d at (%d,%d)\n", hwnd,
+                         infoPtr->nWidth, infoPtr->nHeight,
+                         -nPos, 0);
+            SetWindowPos(infoPtr->hwndChild, 0,
+                         -nPos, 0,
+                         infoPtr->nWidth, infoPtr->nHeight,
+                         SWP_NOZORDER);
+        }
+        else
+        {
+            int wndSize = max(0, rcClient.bottom - rcClient.top);
+            if (infoPtr->nHeight < wndSize)
+                infoPtr->nHeight = wndSize;
+
+            TRACE("[%04x] SWP %dx%d at (%d,%d)\n", hwnd, 
+                         infoPtr->nWidth, infoPtr->nHeight,
+                         0, -nPos);
+            SetWindowPos(infoPtr->hwndChild, 0,
+                         0, -nPos,
+                         infoPtr->nWidth, infoPtr->nHeight,
+                         SWP_NOZORDER);
+        }
+
+        InvalidateRect(infoPtr->hwndChild, NULL, TRUE);
+    }
+}
+
+static INT
+PAGER_GetScrollRange(HWND hwnd, PAGER_INFO* infoPtr)
+{
+    INT scrollRange = 0;
+
+    if (infoPtr->hwndChild)
+    {
+        INT wndSize, childSize;
+        RECT wndRect;
+        GetWindowRect(hwnd, &wndRect);
+
+        if (PAGER_IsHorizontal(hwnd))
+        {
+            wndSize = wndRect.right - wndRect.left;
+            PAGER_CalcSize(hwnd, &infoPtr->nWidth, TRUE);
+            childSize = infoPtr->nWidth;
+        }
+        else
+        {
+            wndSize = wndRect.bottom - wndRect.top;
+            PAGER_CalcSize(hwnd, &infoPtr->nHeight, FALSE);
+            childSize = infoPtr->nHeight;
+        }
+
+        TRACE("childSize = %d,  wndSize = %d\n", childSize, wndSize);
+        if (childSize > wndSize)
+            scrollRange = childSize - wndSize + infoPtr->nButtonSize;
+    }
+
+    TRACE("[%04x] returns %d\n", hwnd, scrollRange);
+    return scrollRange;
+}
+
+static void 
+PAGER_GrayAndRestoreBtns(PAGER_INFO* infoPtr, INT scrollRange,
+                         BOOL* needsResize, BOOL* needsRepaint)
+{
+    if (infoPtr->nPos > 0)
+    {
+        *needsResize |= !infoPtr->TLbtnState; /* PGF_INVISIBLE */
+        if (infoPtr->TLbtnState != PGF_DEPRESSED)
+            infoPtr->TLbtnState = PGF_NORMAL;
+    }
+    else
+    {
+        *needsRepaint |= (infoPtr->TLbtnState != PGF_GRAYED);
+        infoPtr->TLbtnState = PGF_GRAYED;
+    }
+
+    if (scrollRange <= 0)
+    {
+        *needsRepaint |= (infoPtr->TLbtnState != PGF_GRAYED);
+        infoPtr->TLbtnState = PGF_GRAYED;
+        *needsRepaint |= (infoPtr->BRbtnState != PGF_GRAYED);
+        infoPtr->BRbtnState = PGF_GRAYED;
+    }
+    else if (infoPtr->nPos < scrollRange)
+    {
+        *needsResize |= !infoPtr->BRbtnState; /* PGF_INVISIBLE */
+        if (infoPtr->BRbtnState != PGF_DEPRESSED)
+            infoPtr->BRbtnState = PGF_NORMAL;
+    }
+    else
+    {
+        *needsRepaint |= (infoPtr->BRbtnState != PGF_GRAYED);
+        infoPtr->BRbtnState = PGF_GRAYED;
+    }
+}
+
+
+static void 
+PAGER_NormalizeBtns(PAGER_INFO* infoPtr, BOOL* needsRepaint)
+{
+    if (infoPtr->TLbtnState & (PGF_HOT | PGF_DEPRESSED))
+    {
+        infoPtr->TLbtnState = PGF_NORMAL;
+        *needsRepaint = TRUE;
+    }
+
+    if (infoPtr->BRbtnState & (PGF_HOT | PGF_DEPRESSED))
+    {
+        infoPtr->BRbtnState = PGF_NORMAL;
+        *needsRepaint = TRUE;
+    }
+}
+
+static void 
+PAGER_HideGrayBtns(PAGER_INFO* infoPtr, BOOL* needsResize)
+{
+    if (infoPtr->TLbtnState == PGF_GRAYED)
+    {
+        infoPtr->TLbtnState = PGF_INVISIBLE;
+        *needsResize = TRUE;
+    }
+
+    if (infoPtr->BRbtnState == PGF_GRAYED)
+    {
+        infoPtr->BRbtnState = PGF_INVISIBLE;
+        *needsResize = TRUE;
+    }
+}
+
+static void
+PAGER_UpdateBtns(HWND hwnd, PAGER_INFO *infoPtr,
+                 INT scrollRange, BOOL hideGrayBtns)
+{
+    BOOL resizeClient = FALSE;
+    BOOL repaintBtns = FALSE;
+
+    if (scrollRange < 0)
+        PAGER_NormalizeBtns(infoPtr, &repaintBtns);
+    else
+        PAGER_GrayAndRestoreBtns(infoPtr, scrollRange, &resizeClient, &repaintBtns);
+
+    if (hideGrayBtns)
+        PAGER_HideGrayBtns(infoPtr, &resizeClient);
+
+    if (resizeClient) /* initiate NCCalcSize to resize client wnd */
+        SetWindowPos(hwnd, 0,0,0,0,0, 
+                     SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE |
+                     SWP_NOZORDER | SWP_NOACTIVATE);
+
+    if (repaintBtns)
+        SendMessageA(hwnd, WM_NCPAINT, 0, 0); 
+}
+
+static LRESULT  
+PAGER_SetPos(HWND hwnd, INT newPos, BOOL fromBtnPress)
+{
+    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
+    INT scrollRange = PAGER_GetScrollRange(hwnd, infoPtr);
+
+    if ((scrollRange <= 0) || (newPos < 0))
+        infoPtr->nPos = 0;
+    else if (newPos > scrollRange)
+        infoPtr->nPos = scrollRange;
+    else
+        infoPtr->nPos = newPos;
+
+    TRACE("[%04x] pos=%d\n", hwnd, infoPtr->nPos);
+
+    /* gray and restore btns, and if from WM_SETPOS, hide the gray btns */
+    PAGER_UpdateBtns(hwnd, infoPtr, scrollRange, !fromBtnPress);
+    PAGER_PositionChildWnd(hwnd, infoPtr);
+
+    return 0;
+}
+
+static LRESULT
+PAGER_HandleWindowPosChanging(HWND hwnd, WINDOWPOS *winpos)
+{
+    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
+
+    if (infoPtr->bNoResize && !(winpos->flags & SWP_NOSIZE))
+    {
+        /* don't let the app resize the nonscrollable dimension of a control
+         * that was created with CCS_NORESIZE style
+         * (i.e. height for a horizontal pager, or width for a vertical one) */
+
+        if (PAGER_IsHorizontal(hwnd))
+            winpos->cy = infoPtr->nHeight;
+        else
+            winpos->cx = infoPtr->nWidth;
+    }
+
+    return 0;
+}
+
+static void 
+PAGER_SetFixedWidth(HWND hwnd, PAGER_INFO* infoPtr)
+{
+  /* Must set the non-scrollable dimension to be less than the full height/width
+   * so that NCCalcSize is called.  The Msoft docs mention 3/4 factor for button
+   * size, and experimentation shows that affect is almost right. */
+
+    RECT wndRect;
+    INT delta, h;
+    GetWindowRect(hwnd, &wndRect);
+
+    /* see what the app says for btn width */
+    PAGER_CalcSize(hwnd, &infoPtr->nWidth, TRUE);
+
+    if (infoPtr->bNoResize)
+    {
+        delta = wndRect.right - wndRect.left - infoPtr->nWidth;
+        if (delta > infoPtr->nButtonSize)
+            infoPtr->nWidth += 4 * infoPtr->nButtonSize / 3;
+        else if (delta > 0)
+            infoPtr->nWidth +=  infoPtr->nButtonSize / 3;
+    }
+
+    h = wndRect.bottom - wndRect.top + infoPtr->nButtonSize;
+
+    /* adjust non-scrollable dimension to fit the child */
+    SetWindowPos(hwnd, 0, 0,0, infoPtr->nWidth, h, 
+                 SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER);
+
+
+    TRACE("[%04x] infoPtr->nWidth set to %d\n",
+	       hwnd, infoPtr->nWidth);
+}
+
+static void 
+PAGER_SetFixedHeight(HWND hwnd, PAGER_INFO* infoPtr)
+{
+  /* Must set the non-scrollable dimension to be less than the full height/width
+   * so that NCCalcSize is called.  The Msoft docs mention 3/4 factor for button
+   * size, and experimentation shows that affect is almost right. */
+
+    RECT wndRect;
+    INT delta, w;
+    GetWindowRect(hwnd, &wndRect);
+
+    /* see what the app says for btn height */
+    PAGER_CalcSize(hwnd, &infoPtr->nHeight, FALSE);
+
+    if (infoPtr->bNoResize)
+    {
+        delta = wndRect.bottom - wndRect.top - infoPtr->nHeight;
+        if (delta > infoPtr->nButtonSize)
+            infoPtr->nHeight += 4 * infoPtr->nButtonSize / 3;
+        else if (delta > 0)
+            infoPtr->nHeight +=  infoPtr->nButtonSize / 3;
+    }
+
+    w = wndRect.right - wndRect.left + infoPtr->nButtonSize;
+
+    /* adjust non-scrollable dimension to fit the child */
+    SetWindowPos(hwnd, 0, 0,0, w, infoPtr->nHeight, 
+                 SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER);
+
+    TRACE("[%04x] infoPtr->nHeight set to %d\n",
+	       hwnd, infoPtr->nHeight);
+}
+
+static LRESULT
+PAGER_RecalcSize(HWND hwnd)
+{
+    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
+
+    TRACE("[%04x]\n", hwnd);
+
+    if (infoPtr->hwndChild)
+    {
+        INT scrollRange = PAGER_GetScrollRange(hwnd, infoPtr);
+
+        if (scrollRange <= 0)
+            PAGER_SetPos(hwnd, 0, FALSE);
+        else 
+        {
+            PAGER_UpdateBtns(hwnd, infoPtr, scrollRange, TRUE);
+            PAGER_PositionChildWnd(hwnd, infoPtr);
+        }
+    }
+
+    return 1;
+}
+
+
+static LRESULT
+PAGER_SetBkColor (HWND hwnd, WPARAM wParam, LPARAM lParam)
+{
+    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
+    COLORREF clrTemp = infoPtr->clrBk;
+
+    infoPtr->clrBk = (COLORREF)lParam;
+    TRACE("[%04x] %06lx\n", hwnd, infoPtr->clrBk);
+
+    PAGER_RecalcSize(hwnd);
+    SendMessageA(hwnd, WM_NCPAINT, (WPARAM)0, (LPARAM)0);
+
+    return (LRESULT)clrTemp;
+}
+
+
+static LRESULT
+PAGER_SetBorder (HWND hwnd, WPARAM wParam, LPARAM lParam)
+{
+    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
+    INT nTemp = infoPtr->nBorder;
+
+    infoPtr->nBorder = (INT)lParam;
+    TRACE("[%04x] %d\n", hwnd, infoPtr->nBorder);
+
+    PAGER_RecalcSize(hwnd);
+
+    return (LRESULT)nTemp;
+}
+
+
+static LRESULT
+PAGER_SetButtonSize (HWND hwnd, WPARAM wParam, LPARAM lParam)
+{
+    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
+    INT nTemp = infoPtr->nButtonSize;
+
+    infoPtr->nButtonSize = (INT)lParam;
+    TRACE("[%04x] %d\n", hwnd, infoPtr->nButtonSize);
+
+    PAGER_RecalcSize(hwnd);
+
+    return (LRESULT)nTemp;
+}
+
+
+static LRESULT
+PAGER_SetChild (HWND hwnd, WPARAM wParam, LPARAM lParam)
+{
+    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
+
+    infoPtr->hwndChild = IsWindow ((HWND)lParam) ? (HWND)lParam : 0;
+
+    if (infoPtr->hwndChild)
+    {
+        TRACE("[%04x] hwndChild=%04x\n", hwnd, infoPtr->hwndChild);
+
+        if (PAGER_IsHorizontal(hwnd))
+            PAGER_SetFixedHeight(hwnd, infoPtr);
+        else
+            PAGER_SetFixedWidth(hwnd, infoPtr);
+
+        /* position child within the page scroller */
+        SetWindowPos(infoPtr->hwndChild, HWND_TOP,
+                     0,0,0,0,
+                     SWP_SHOWWINDOW | SWP_NOSIZE);
+
+        PAGER_SetPos(hwnd, 0, FALSE);
+    }
+
+    return 0;
+}
+
+static void
+PAGER_Scroll(HWND hwnd, INT dir)
+{
+    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
+    NMPGSCROLL nmpgScroll;
+    RECT rcWnd;
+
+    if (infoPtr->hwndChild)
+    {
+        ZeroMemory (&nmpgScroll, sizeof (NMPGSCROLL));
+        nmpgScroll.hdr.hwndFrom = hwnd;
+        nmpgScroll.hdr.idFrom   = GetWindowLongA (hwnd, GWL_ID);
+        nmpgScroll.hdr.code = PGN_SCROLL;
+
+        GetWindowRect(hwnd, &rcWnd);  
+        GetClientRect(hwnd, &nmpgScroll.rcParent);  
+        nmpgScroll.iXpos = nmpgScroll.iYpos = 0;
+        nmpgScroll.iDir = dir;
+
+        if (PAGER_IsHorizontal(hwnd))
+        {
+            nmpgScroll.iScroll = rcWnd.right - rcWnd.left;
+            nmpgScroll.iXpos = infoPtr->nPos;
+        }
+        else
+        {
+            nmpgScroll.iScroll = rcWnd.bottom - rcWnd.top;
+            nmpgScroll.iYpos = infoPtr->nPos;
+        }
+        nmpgScroll.iScroll -= 2*infoPtr->nButtonSize;
+  
+        SendMessageA (hwnd, WM_NOTIFY,
+                    (WPARAM)nmpgScroll.hdr.idFrom, (LPARAM)&nmpgScroll);
+  
+        TRACE("[%04x] PGN_SCROLL returns iScroll=%d\n", hwnd, nmpgScroll.iScroll);
+
+        if (nmpgScroll.iScroll > 0)
+        {
+            if (dir == PGF_SCROLLLEFT || dir == PGF_SCROLLUP)
+                PAGER_SetPos(hwnd, infoPtr->nPos - nmpgScroll.iScroll, TRUE);
+            else
+                PAGER_SetPos(hwnd, infoPtr->nPos + nmpgScroll.iScroll, TRUE);
+        }
+    }
+}
+
+static LRESULT
+PAGER_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
+{
+    PAGER_INFO *infoPtr;
+    DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE);
+
+    /* allocate memory for info structure */
+#ifdef __WIN32OS2__
+    infoPtr =(PAGER_INFO*)initControl(hwnd,sizeof(PAGER_INFO));
+#else
+    infoPtr = (PAGER_INFO *)COMCTL32_Alloc (sizeof(PAGER_INFO));
+#endif
+    SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
+
+    /* set default settings */
+    infoPtr->hwndChild = (HWND)NULL;
+    infoPtr->bNoResize = dwStyle & CCS_NORESIZE;
+    infoPtr->clrBk = GetSysColor(COLOR_BTNFACE);
+    infoPtr->nBorder = 0;
+    infoPtr->nButtonSize = 12;
+    infoPtr->nPos = 0;
+    infoPtr->nWidth = 0;
+    infoPtr->nHeight = 0;
+    infoPtr->bForward = FALSE;
+    infoPtr->TLbtnState = PGF_INVISIBLE;
+    infoPtr->BRbtnState = PGF_INVISIBLE;
+
+    if (dwStyle & PGS_AUTOSCROLL)
+        FIXME("[%04x] Autoscroll style is not implemented yet.\n", hwnd);
+    if (dwStyle & PGS_DRAGNDROP)
+        FIXME("[%04x] Drag and Drop style is not implemented yet.\n", hwnd);
+    /*
+	 * If neither horizontal nor vertical style specified, default to vertical.
+	 * This is probably not necessary, since the style may be set later on as
+	 * the control is initialized, but just in case it isn't, set it here.
+	 */
+    if (!(dwStyle & PGS_HORZ) && !(dwStyle & PGS_VERT))
+    {
+        dwStyle |= PGS_VERT;
+        SetWindowLongA(hwnd, GWL_STYLE, dwStyle);
+    }
+
+    return 0;
+}
+
+
+static LRESULT
+PAGER_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
+{
+    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
+    /* free pager info data */
+    COMCTL32_Free (infoPtr);
+    SetWindowLongA (hwnd, 0, 0);
+    return 0;
+}
+
+static LRESULT
+PAGER_NCCalcSize(HWND hwnd, WPARAM wParam, LPARAM lParam)
+{
+    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
+    LPRECT lpRect = (LPRECT)lParam;
+    /*
+     * lParam points to a RECT struct.  On entry, the struct
+     * contains the proposed wnd rectangle for the window. 
+     * On exit, the struct should contain the screen
+     * coordinates of the corresponding window's client area.
+     */
+	
+    if (PAGER_IsHorizontal(hwnd))
+    {
+        if (infoPtr->TLbtnState) /* != PGF_INVISIBLE */
+            lpRect->left += infoPtr->nButtonSize;
+        if (infoPtr->BRbtnState) 
+            lpRect->right -= infoPtr->nButtonSize;
+    }
+    else
+    {
+        if (infoPtr->TLbtnState)
+            lpRect->top += infoPtr->nButtonSize;
+        if (infoPtr->BRbtnState)
+            lpRect->bottom -= infoPtr->nButtonSize;
+    }
+
+    TRACE("[%04x] client rect set to %dx%d at (%d,%d)\n", hwnd,
+                lpRect->right-lpRect->left,
+                lpRect->bottom-lpRect->top,
+                lpRect->left, lpRect->top);
+
+    return 0;
+}
+
+static LRESULT
+PAGER_NCPaint (HWND hwnd, WPARAM wParam, LPARAM lParam)
+{
+    PAGER_INFO* infoPtr = PAGER_GetInfoPtr(hwnd);
+    DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE);
+    RECT rcWindow, rcBottomRight, rcTopLeft;
+    HDC hdc;
+    BOOL bHorizontal = PAGER_IsHorizontal(hwnd);
+
+    if (dwStyle & WS_MINIMIZE)
+        return 0;
+
+    DefWindowProcA (hwnd, WM_NCPAINT, wParam, lParam);
+
+    if (!(hdc = GetDCEx (hwnd, 0, DCX_USESTYLE | DCX_WINDOW)))
+        return 0;
+
+    GetWindowRect (hwnd, &rcWindow);
+    OffsetRect (&rcWindow, -rcWindow.left, -rcWindow.top);
+
+    rcTopLeft = rcBottomRight = rcWindow;
+    if (bHorizontal)
+    {
+        rcTopLeft.right = rcTopLeft.left + infoPtr->nButtonSize;
+        rcBottomRight.left = rcBottomRight.right - infoPtr->nButtonSize;
+    }
+    else
+    {
+        rcTopLeft.bottom = rcTopLeft.top + infoPtr->nButtonSize;
+        rcBottomRight.top = rcBottomRight.bottom - infoPtr->nButtonSize;
+    }
+
+    PAGER_DrawButton(hdc, infoPtr->clrBk, rcTopLeft,
+                     bHorizontal, TRUE, infoPtr->TLbtnState);
+    PAGER_DrawButton(hdc, infoPtr->clrBk, rcBottomRight,
+                     bHorizontal, FALSE, infoPtr->BRbtnState); 
+
+    ReleaseDC( hwnd, hdc );
+    return 0;
+}
+
+static INT 
+PAGER_HitTest (HWND hwnd, LPPOINT pt)
+{
+    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
+    RECT clientRect;
+    BOOL bHorizontal = PAGER_IsHorizontal(hwnd);
+
+    GetClientRect (hwnd, &clientRect);
+
+    if (PtInRect(&clientRect, *pt))
+    {
+       /* TRACE("HTCLIENT\n"); */
+        return HTCLIENT;
+    }
+
+    if (infoPtr->TLbtnState && infoPtr->TLbtnState != PGF_GRAYED)
+    {
+        if (bHorizontal)
+        {
+            if (pt->x < clientRect.left)
+            {
+                /* TRACE("HTLEFT\n"); */
+                return HTLEFT;
+            }
+        }
+        else
+        {
+            if (pt->y < clientRect.top)
+            {
+                /* TRACE("HTTOP\n"); */
+                return HTTOP;
+            }
+        }
+    }
+
+    if (infoPtr->BRbtnState && infoPtr->BRbtnState != PGF_GRAYED)
+    {
+        if (bHorizontal)
+        {
+            if (pt->x > clientRect.right)
+            {
+                /* TRACE("HTRIGHT\n"); */
+                return HTRIGHT;
+            }
+        }
+        else
+        {
+            if (pt->y > clientRect.bottom)
+            {
+               /* TRACE("HTBOTTOM\n"); */
+                return HTBOTTOM;
+            }
+        }
+    }
+
+    /* TRACE("HTNOWHERE\n"); */
+    return HTNOWHERE;
+}
+
+static LRESULT
+PAGER_NCHitTest (HWND hwnd, WPARAM wParam, LPARAM lParam)
+{
+    POINT pt = { SLOWORD(lParam), SHIWORD(lParam) };
+    ScreenToClient (hwnd, &pt);
+    return PAGER_HitTest(hwnd, &pt);
+}
+
+static LRESULT
+PAGER_SetCursor( HWND hwnd, WPARAM wParam, LPARAM lParam )
+{
+    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
+    BOOL notCaptured = FALSE;
+
+    switch(LOWORD(lParam))
+    {
+        case HTLEFT:
+        case HTTOP:
+            if ((notCaptured = infoPtr->TLbtnState != PGF_HOT))
+                infoPtr->TLbtnState = PGF_HOT;
+            break;
+        case HTRIGHT:
+        case HTBOTTOM:
+            if ((notCaptured = infoPtr->BRbtnState != PGF_HOT))
+               infoPtr->BRbtnState = PGF_HOT;
+            break;
+        default:
+            return FALSE;
+    }
+
+    if (notCaptured)
+    {
+        TRACKMOUSEEVENT trackinfo;
+
+        TRACE("[%04x] SetCapture\n", hwnd);
+        SetCapture(hwnd);
+
+        trackinfo.cbSize = sizeof(TRACKMOUSEEVENT);
+        trackinfo.dwFlags = TME_QUERY;
+        trackinfo.hwndTrack = hwnd;
+        trackinfo.dwHoverTime = HOVER_DEFAULT;
+
+        /* call _TrackMouseEvent to see if we are currently tracking for this hwnd */
+        _TrackMouseEvent(&trackinfo);
+
+        /* Make sure tracking is enabled so we receive a WM_MOUSELEAVE message */
+        if(!(trackinfo.dwFlags & TME_LEAVE)) {
+            trackinfo.dwFlags = TME_LEAVE; /* notify upon leaving */
+ 
+           /* call TRACKMOUSEEVENT so we receive a WM_MOUSELEAVE message */
+           /* and can properly deactivate the hot button */
+           _TrackMouseEvent(&trackinfo);
+        }
+
+        SendMessageA(hwnd, WM_NCPAINT, 0, 0); 
+    }
+
+    return TRUE;
+}
+
+static LRESULT
+PAGER_MouseLeave (HWND hwnd, WPARAM wParam, LPARAM lParam)
+{
+    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
+
+    TRACE("[%04x] ReleaseCapture\n", hwnd);
+    ReleaseCapture();
+
+    /* Notify parent of released mouse capture */
+    {
+        NMHDR nmhdr;
+        ZeroMemory (&nmhdr, sizeof (NMHDR));
+        nmhdr.hwndFrom = hwnd;
+        nmhdr.idFrom   = GetWindowLongA (hwnd, GWL_ID);
+        nmhdr.code = NM_RELEASEDCAPTURE;
+        SendMessageA (GetParent(hwnd), WM_NOTIFY,
+                        (WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr);
+    }
+
+    /* make HOT btns NORMAL and hide gray btns */
+    PAGER_UpdateBtns(hwnd, infoPtr, -1, TRUE);
+
+    return TRUE;
+}
+
+static LRESULT
+PAGER_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
+{
+    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
+    BOOL repaintBtns = FALSE;
+    POINT pt = { SLOWORD(lParam), SHIWORD(lParam) };
+    INT hit;
+
+    TRACE("[%04x]\n", hwnd);
+	
+    hit = PAGER_HitTest(hwnd, &pt);
+
+    /* put btn in DEPRESSED state */
+    if (hit == HTLEFT || hit == HTTOP)
+    {
+        repaintBtns = infoPtr->TLbtnState != PGF_DEPRESSED;
+        infoPtr->TLbtnState = PGF_DEPRESSED;
+    }
+    else if (hit == HTRIGHT || hit == HTBOTTOM)
+    {
+        repaintBtns = infoPtr->BRbtnState != PGF_DEPRESSED;
+        infoPtr->BRbtnState = PGF_DEPRESSED;
+    }
+
+    if (repaintBtns)
+        SendMessageA(hwnd, WM_NCPAINT, 0, 0); 
+
+    switch(hit)
+    {
+    case HTLEFT:
+        TRACE("[%04x] PGF_SCROLLLEFT\n", hwnd);
+        PAGER_Scroll(hwnd, PGF_SCROLLLEFT);
+        break;
+    case HTTOP:
+        TRACE("[%04x] PGF_SCROLLUP\n", hwnd);
+        PAGER_Scroll(hwnd, PGF_SCROLLUP);
+        break;
+    case HTRIGHT:
+        TRACE("[%04x] PGF_SCROLLRIGHT\n", hwnd);
+        PAGER_Scroll(hwnd, PGF_SCROLLRIGHT);
+        break;
+    case HTBOTTOM:
+        TRACE("[%04x] PGF_SCROLLDOWN\n", hwnd);
+        PAGER_Scroll(hwnd, PGF_SCROLLDOWN);
+        break;
+    default:
+        break;
+    }
+
+    return TRUE;
+}
+
+static LRESULT
+PAGER_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
+{
+    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
+    TRACE("[%04x]\n", hwnd);
+
+    /* make PRESSED btns NORMAL but don't hide gray btns */
+    PAGER_UpdateBtns(hwnd, infoPtr, -1, FALSE);
+
+    return 0;
+}
+
+static LRESULT
+PAGER_EraseBackground (HWND hwnd, WPARAM wParam, LPARAM lParam)
+{
+    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
+    HBRUSH hBrush = CreateSolidBrush(infoPtr->clrBk);
+    RECT rect;
+
+    GetClientRect (hwnd, &rect);
+    FillRect ((HDC)wParam, &rect, hBrush);
+
+    /* background color of the child should be the same as the pager */
+    if (infoPtr->hwndChild)
+    {
+        GetClientRect (infoPtr->hwndChild, &rect);
+        FillRect ((HDC)wParam, &rect, hBrush);
+    }
+
+    DeleteObject (hBrush);
+    return TRUE;
+}
+
+
+static LRESULT
+PAGER_Size (HWND hwnd, WPARAM wParam, LPARAM lParam)
+{
+    /* note that WM_SIZE is sent whenever NCCalcSize resizes the client wnd */
+
+    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
+    TRACE("[%04x] %dx%d\n", hwnd, LOWORD(lParam), HIWORD(lParam));
+
+    if (PAGER_IsHorizontal(hwnd))
+        infoPtr->nHeight = HIWORD(lParam);
+    else
+        infoPtr->nWidth = LOWORD(lParam);
+
+    return PAGER_RecalcSize(hwnd);
+}
+
+
+static LRESULT WINAPI
+PAGER_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
+
+    if (!infoPtr && (uMsg != WM_CREATE))
+	return DefWindowProcA (hwnd, uMsg, wParam, lParam);
+
+    switch (uMsg)
+    {
+        case PGM_FORWARDMOUSE:
+            return PAGER_ForwardMouse (hwnd, wParam);
+
+        case PGM_GETBKCOLOR:
+            return PAGER_GetBkColor(hwnd);
+
+        case PGM_GETBORDER:
+            return PAGER_GetBorder(hwnd);
+
+        case PGM_GETBUTTONSIZE:
+            return PAGER_GetButtonSize(hwnd);
+
+        case PGM_GETPOS:
+            return PAGER_GetPos(hwnd);
+
+        case PGM_GETBUTTONSTATE:
+            return PAGER_GetButtonState (hwnd, wParam, lParam);
+
+/*      case PGM_GETDROPTARGET: */
+
+        case PGM_RECALCSIZE:
+            return PAGER_RecalcSize(hwnd);
+    
+        case PGM_SETBKCOLOR:
+            return PAGER_SetBkColor (hwnd, wParam, lParam);
+
+        case PGM_SETBORDER:
+            return PAGER_SetBorder (hwnd, wParam, lParam);
+
+        case PGM_SETBUTTONSIZE:
+            return PAGER_SetButtonSize (hwnd, wParam, lParam);
+
+        case PGM_SETCHILD:
+            return PAGER_SetChild (hwnd, wParam, lParam);
+
+        case PGM_SETPOS:
+            return PAGER_SetPos(hwnd, (INT)lParam, FALSE);
+
+        case WM_CREATE:
+            return PAGER_Create (hwnd, wParam, lParam);
+
+        case WM_DESTROY:
+            return PAGER_Destroy (hwnd, wParam, lParam);
+
+        case WM_SIZE:
+            return PAGER_Size (hwnd, wParam, lParam);
+
+        case WM_NCPAINT:
+            return PAGER_NCPaint (hwnd, wParam, lParam);
+
+        case WM_WINDOWPOSCHANGING:
+            return PAGER_HandleWindowPosChanging (hwnd, (WINDOWPOS*)lParam);
+
+        case WM_NCCALCSIZE:
+            return PAGER_NCCalcSize (hwnd, wParam, lParam);
+
+        case WM_NCHITTEST:
+            return PAGER_NCHitTest (hwnd, wParam, lParam);
+
+        case WM_SETCURSOR:
+        {
+            if (hwnd == (HWND)wParam)
+                return PAGER_SetCursor(hwnd, wParam, lParam);
+            else /* its for the child */
+                return 0;
+        }
+
+        case WM_MOUSEMOVE:
+            if (infoPtr->bForward && infoPtr->hwndChild)
+                PostMessageA(infoPtr->hwndChild, WM_MOUSEMOVE, wParam, lParam);
+            return TRUE;			
+
+        case WM_MOUSELEAVE:
+            return PAGER_MouseLeave (hwnd, wParam, lParam);	
+
+        case WM_LBUTTONDOWN:
+            return PAGER_LButtonDown (hwnd, wParam, lParam);
+
+        case WM_LBUTTONUP:
+            return PAGER_LButtonUp (hwnd, wParam, lParam);
+
+        case WM_ERASEBKGND:
+            return PAGER_EraseBackground (hwnd, wParam, lParam);
+/*
+        case WM_PAINT:
+            return PAGER_Paint (hwnd, wParam); 
+*/
+        case WM_NOTIFY:
+        case WM_COMMAND:
+            return SendMessageA (GetParent (hwnd), uMsg, wParam, lParam);
+
+        default:
+#ifdef __WIN32OS2__
+            return defComCtl32ProcA(hwnd, uMsg, wParam, lParam);
+#else
+            return DefWindowProcA(hwnd, uMsg, wParam, lParam);
+#endif
+    }
+
+    return 0;
+}
+
+
+VOID
+PAGER_Register (void)
+{
+    WNDCLASSA wndClass;
+
+    ZeroMemory (&wndClass, sizeof(WNDCLASSA));
+    wndClass.style         = CS_GLOBALCLASS | CS_DBLCLKS | CS_SAVEBITS;
+    wndClass.lpfnWndProc   = (WNDPROC)PAGER_WindowProc;
+    wndClass.cbClsExtra    = 0;
+    wndClass.cbWndExtra    = sizeof(PAGER_INFO *);
+    wndClass.hCursor       = LoadCursorA (0, IDC_ARROWA);
+    wndClass.hbrBackground = 0;
+    wndClass.lpszClassName = WC_PAGESCROLLERA;
+ 
+    RegisterClassA (&wndClass);
+}
+
+
+VOID
+PAGER_Unregister (void)
+{
+    UnregisterClassA (WC_PAGESCROLLERA, (HINSTANCE)NULL);
+}
+
Index: trunk/src/comctl32/pager.cpp
===================================================================
--- trunk/src/comctl32/pager.cpp	(revision 5413)
+++ 	(revision )
@@ -1,398 +1,0 @@
-/* $Id: pager.cpp,v 1.3 2000-03-21 17:30:44 cbratschi Exp $ */
-/*
- * Pager control
- *
- * Copyright 1998, 1999 Eric Kohl
- * Copyright 1999 Achim Hasenmueller
- *
- * NOTES
- *   This is just a dummy control. An author is needed! Any volunteers?
- *   I will only improve this control once in a while.
- *     Eric <ekohl@abo.rhein-zeitung.de>
- *
- * TODO:
- *   - All messages.
- *   - All notifications.
- */
-
-#include "winbase.h"
-#include "commctrl.h"
-#include "ccbase.h"
-#include "pager.h"
-
-#define PAGER_GetInfoPtr(hwnd) ((PAGER_INFO*)getInfoPtr(hwnd))
-
-static LRESULT
-PAGER_ForwardMouse (HWND hwnd, WPARAM wParam)
-{
-    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
-
-    infoPtr->bForward = (BOOL)wParam;
-
-    return 0;
-}
-
-
-static LRESULT
-PAGER_GetBkColor (HWND hwnd, WPARAM wParam, LPARAM lParam)
-{
-    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
-
-    return (LRESULT)infoPtr->clrBk;
-}
-
-
-static LRESULT
-PAGER_GetBorder (HWND hwnd, WPARAM wParam, LPARAM lParam)
-{
-    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
-
-    return (LRESULT)infoPtr->nBorder;
-}
-
-
-static LRESULT
-PAGER_GetButtonSize (HWND hwnd, WPARAM wParam, LPARAM lParam)
-{
-    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
-
-    return (LRESULT)infoPtr->nButtonSize;
-}
-
-
-static LRESULT
-PAGER_GetButtonState (HWND hwnd, WPARAM wParam, LPARAM lParam)
-{
-    /* PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); */
-
-//    FIXME (pager, "empty stub!\n");
-
-    return PGF_INVISIBLE;
-}
-
-
-/* << PAGER_GetDropTarget >> */
-
-
-static LRESULT
-PAGER_GetPos (HWND hwnd, WPARAM wParam, LPARAM lParam)
-{
-    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
-
-    return infoPtr->nPos;
-}
-
-
-static LRESULT
-PAGER_RecalcSize (HWND hwnd, WPARAM wParam, LPARAM lParam)
-{
-    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
-    DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE);
-    NMPGCALCSIZE nmpgcs;
-
-    if (infoPtr->hwndChild) {
-        ZeroMemory (&nmpgcs, sizeof (NMPGCALCSIZE));
-        nmpgcs.dwFlag = (dwStyle & PGS_HORZ) ? PGF_CALCWIDTH : PGF_CALCHEIGHT;
-        sendNotify(hwnd,PGN_CALCSIZE,&nmpgcs.hdr);
-
-        infoPtr->nChildSize = (dwStyle & PGS_HORZ) ? nmpgcs.iWidth : nmpgcs.iHeight;
-
-
-//        FIXME (pager, "Child size %d\n", infoPtr->nChildSize);
-
-
-    }
-
-    return 0;
-}
-
-
-static LRESULT
-PAGER_SetBkColor (HWND hwnd, WPARAM wParam, LPARAM lParam)
-{
-    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
-    COLORREF clrTemp = infoPtr->clrBk;
-
-    infoPtr->clrBk = (COLORREF)lParam;
-
-    /* FIXME: redraw */
-
-    return (LRESULT)clrTemp;
-}
-
-
-static LRESULT
-PAGER_SetBorder (HWND hwnd, WPARAM wParam, LPARAM lParam)
-{
-    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
-    INT nTemp = infoPtr->nBorder;
-
-    infoPtr->nBorder = (INT)lParam;
-
-    /* FIXME: redraw */
-
-    return (LRESULT)nTemp;
-}
-
-
-static LRESULT
-PAGER_SetButtonSize (HWND hwnd, WPARAM wParam, LPARAM lParam)
-{
-    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
-    INT nTemp = infoPtr->nButtonSize;
-
-    infoPtr->nButtonSize = (INT)lParam;
-
-//    FIXME (pager, "size=%d\n", infoPtr->nButtonSize);
-
-    /* FIXME: redraw */
-
-    return (LRESULT)nTemp;
-}
-
-
-static LRESULT
-PAGER_SetChild (HWND hwnd, WPARAM wParam, LPARAM lParam)
-{
-    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
-
-    infoPtr->hwndChild = IsWindow ((HWND)lParam) ? (HWND)lParam : 0;
-
-//    FIXME (pager, "hwnd=%x\n", infoPtr->hwndChild);
-
-    /* FIXME: redraw */
-    if (infoPtr->hwndChild) {
-        RECT rect;
-
-        GetClientRect(hwnd,&rect);
-        SetParent (infoPtr->hwndChild, hwnd);
-        SetWindowPos (infoPtr->hwndChild, HWND_TOP,
-                        0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOSIZE);
-
-        MoveWindow (infoPtr->hwndChild, 0, 0, rect.right, rect.bottom, TRUE);
-    }
-
-    return 0;
-}
-
-
-static LRESULT
-PAGER_SetPos (HWND hwnd, WPARAM wParam, LPARAM lParam)
-{
-    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
-
-    infoPtr->nPos = (INT)lParam;
-
-//    FIXME (pager, "pos=%d\n", infoPtr->nPos);
-
-    /* FIXME: redraw */
-    SetWindowPos (infoPtr->hwndChild, HWND_TOP,
-                    0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOSIZE);
-
-    return 0;
-}
-
-
-static LRESULT
-PAGER_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
-{
-    PAGER_INFO *infoPtr;
-
-    /* allocate memory for info structure */
-    infoPtr = (PAGER_INFO*)initControl(hwnd,sizeof(PAGER_INFO));
-
-    /* set default settings */
-    infoPtr->hwndChild = (HWND)NULL;
-    infoPtr->clrBk = GetSysColor (COLOR_BTNFACE);
-    infoPtr->nBorder = 0;
-    infoPtr->nButtonSize = 0;
-    infoPtr->nPos = 0;
-
-
-    return 0;
-}
-
-
-static LRESULT
-PAGER_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
-{
-    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
-
-    /* free pager info data */
-    doneControl(hwnd);
-
-    return 0;
-}
-
-
-static LRESULT
-PAGER_EraseBackground (HWND hwnd, WPARAM wParam, LPARAM lParam)
-{
-    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
-    HBRUSH hBrush = CreateSolidBrush (infoPtr->clrBk);
-    RECT rect;
-
-    GetClientRect (hwnd, &rect);
-    FillRect ((HDC)wParam, &rect, hBrush);
-    DeleteObject (hBrush);
-
-/*    return TRUE; */
-    return FALSE;
-}
-
-
-static LRESULT
-PAGER_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam)
-{
-    /* PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); */
-
-//    TRACE (pager, "stub!\n");
-
-    return 0;
-}
-
-
-/* << PAGER_Paint >> */
-
-
-static LRESULT
-PAGER_Size (HWND hwnd, WPARAM wParam, LPARAM lParam)
-{
-    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
-    RECT rect;
-
-    GetClientRect (hwnd, &rect);
-    if (infoPtr->hwndChild) {
-        SetWindowPos (infoPtr->hwndChild, HWND_TOP, rect.left, rect.top,
-                        rect.right - rect.left, rect.bottom - rect.top,
-                        SWP_SHOWWINDOW);
-/*      MoveWindow (infoPtr->hwndChild, 1, 1, rect.right - 2, rect.bottom-2, TRUE); */
-/*      UpdateWindow (infoPtr->hwndChild); */
-
-    }
-/*    FillRect ((HDC)wParam, &rect, hBrush); */
-/*    DeleteObject (hBrush); */
-    return TRUE;
-}
-
-static VOID PAGER_Draw(HWND hwnd,HDC hdc,RECT *updateRect)
-{
-  drawStubControl(hwnd,hdc);
-}
-
-static LRESULT PAGER_Paint(HWND hwnd,WPARAM wParam,LPARAM lParam)
-{
-  HDC hdc = (HDC)wParam;
-
-  if (!hdc)
-  {
-    PAINTSTRUCT ps;
-
-    hdc = BeginPaint(hwnd,&ps);
-    PAGER_Draw(hwnd, hdc,&ps.rcPaint);
-    EndPaint(hwnd,&ps);
-  } else
-      PAGER_Draw(hwnd,hdc,NULL);
-
-  return 0;
-}
-
-static LRESULT WINAPI
-PAGER_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
-    switch (uMsg)
-    {
-        case PGM_FORWARDMOUSE:
-            return PAGER_ForwardMouse (hwnd, wParam);
-
-        case PGM_GETBKCOLOR:
-            return PAGER_GetBkColor (hwnd, wParam, lParam);
-
-        case PGM_GETBORDER:
-            return PAGER_GetBorder (hwnd, wParam, lParam);
-
-        case PGM_GETBUTTONSIZE:
-            return PAGER_GetButtonSize (hwnd, wParam, lParam);
-
-        case PGM_GETBUTTONSTATE:
-            return PAGER_GetButtonState (hwnd, wParam, lParam);
-
-/*      case PGM_GETDROPTARGET: */
-
-        case PGM_GETPOS:
-            return PAGER_SetPos (hwnd, wParam, lParam);
-
-        case PGM_RECALCSIZE:
-            return PAGER_RecalcSize (hwnd, wParam, lParam);
-
-        case PGM_SETBKCOLOR:
-            return PAGER_SetBkColor (hwnd, wParam, lParam);
-
-        case PGM_SETBORDER:
-            return PAGER_SetBorder (hwnd, wParam, lParam);
-
-        case PGM_SETBUTTONSIZE:
-            return PAGER_SetButtonSize (hwnd, wParam, lParam);
-
-        case PGM_SETCHILD:
-            return PAGER_SetChild (hwnd, wParam, lParam);
-
-        case PGM_SETPOS:
-            return PAGER_SetPos (hwnd, wParam, lParam);
-
-        case WM_CREATE:
-            return PAGER_Create (hwnd, wParam, lParam);
-
-        case WM_DESTROY:
-            return PAGER_Destroy (hwnd, wParam, lParam);
-
-        case WM_ERASEBKGND:
-            return PAGER_EraseBackground (hwnd, wParam, lParam);
-
-        case WM_MOUSEMOVE:
-            return PAGER_MouseMove (hwnd, wParam, lParam);
-
-        case WM_NOTIFY:
-        case WM_COMMAND:
-            return SendMessageA (GetParent (hwnd), uMsg, wParam, lParam);
-
-        case WM_PAINT:
-          return PAGER_Paint(hwnd,wParam,lParam);
-
-        case WM_SIZE:
-            return PAGER_Size (hwnd, wParam, lParam);
-
-        default:
-          //if (uMsg >= WM_USER)
-          //    ERR (pager, "unknown msg %04x wp=%08x lp=%08lx\n",
-          //         uMsg, wParam, lParam);
-          return defComCtl32ProcA (hwnd, uMsg, wParam, lParam);
-    }
-    return 0;
-}
-
-
-VOID
-PAGER_Register (VOID)
-{
-    WNDCLASSA wndClass;
-
-    ZeroMemory (&wndClass, sizeof(WNDCLASSA));
-    wndClass.style         = CS_GLOBALCLASS | CS_DBLCLKS | CS_SAVEBITS;
-    wndClass.lpfnWndProc   = (WNDPROC)PAGER_WindowProc;
-    wndClass.cbClsExtra    = 0;
-    wndClass.cbWndExtra    = sizeof(PAGER_INFO *);
-    wndClass.hCursor       = LoadCursorA (0, IDC_ARROWA);
-    wndClass.hbrBackground = 0;
-    wndClass.lpszClassName = WC_PAGESCROLLERA;
-
-    RegisterClassA (&wndClass);
-}
-
-
-VOID
-PAGER_Unregister (VOID)
-{
-    UnregisterClassA (WC_PAGESCROLLERA, (HINSTANCE)NULL);
-}
-
Index: trunk/src/comctl32/trackbar.cpp
===================================================================
--- trunk/src/comctl32/trackbar.cpp	(revision 5413)
+++ trunk/src/comctl32/trackbar.cpp	(revision 5416)
@@ -1,3 +1,3 @@
-/* $Id: trackbar.cpp,v 1.5 2000-08-08 17:05:01 cbratschi Exp $ */
+/* $Id: trackbar.cpp,v 1.6 2001-03-31 13:25:27 sandervl Exp $ */
 /*
  * Trackbar control
@@ -20,4 +20,5 @@
 #include "ccbase.h"
 #include "trackbar.h"
+#include "comctl32.h"
 #include <stdio.h>
 
Index: trunk/src/comctl32/updown.cpp
===================================================================
--- trunk/src/comctl32/updown.cpp	(revision 5413)
+++ trunk/src/comctl32/updown.cpp	(revision 5416)
@@ -1,3 +1,3 @@
-/* $Id: updown.cpp,v 1.2 2000-03-18 16:17:35 cbratschi Exp $ */
+/* $Id: updown.cpp,v 1.3 2001-03-31 13:25:27 sandervl Exp $ */
 /*
  * Updown control
@@ -39,4 +39,5 @@
 #include "ccbase.h"
 #include "updown.h"
+#include "comctl32.h"
 
 /* Control configuration constants */
