Commit in reactos/lib/comctl32 on MAIN
comctl_Cs.rc+90added 1.1
.cvsignore+31.5 -> 1.6
Makefile.in+31.5 -> 1.6
animate.c+5-51.5 -> 1.6
comboex.c+18-141.5 -> 1.6
comctl32.h+16-81.8 -> 1.9
comctl32undoc.c+2-11.8 -> 1.9
comctl_Cn.rc+3-31.3 -> 1.4
comctl_De.rc+3-31.4 -> 1.5
comctl_En.rc+3-31.3 -> 1.4
comctl_Es.rc+3-31.3 -> 1.4
comctl_Fr.rc+3-31.3 -> 1.4
comctl_It.rc+3-31.3 -> 1.4
comctl_Ko.rc+3-31.3 -> 1.4
comctl_Nl.rc+3-31.3 -> 1.4
comctl_Pl.rc+3-31.3 -> 1.4
comctl_Pt.rc+3-31.3 -> 1.4
comctl_Ru.rc+3-31.3 -> 1.4
comctl_Si.rc+3-31.3 -> 1.4
comctl_Th.rc+3-31.3 -> 1.4
comctl_Uk.rc+3-31.2 -> 1.3
commctrl.c+174-991.15 -> 1.16
datetime.c+9-81.4 -> 1.5
draglist.c+3-131.4 -> 1.5
flatsb.c+1-11.6 -> 1.7
header.c+27-231.5 -> 1.6
hotkey.c+3-31.3 -> 1.4
imagelist.c+9-341.13 -> 1.14
ipaddress.c+12-121.5 -> 1.6
listview.c+13-131.14 -> 1.15
monthcal.c+9-91.4 -> 1.5
nativefont.c+3-31.2 -> 1.3
pager.c+37-371.3 -> 1.4
progress.c+3-31.6 -> 1.7
propsheet.c+287-2541.12 -> 1.13
rebar.c+5-51.11 -> 1.12
rsrc.rc+791.4 -> 1.5
status.c+10-101.5 -> 1.6
syslink.c+9-81.1 -> 1.2
tab.c+39-601.9 -> 1.10
toolbar.c+493-2101.18 -> 1.19
tooltips.c+232-531.7 -> 1.8
trackbar.c+9-81.5 -> 1.6
treeview.c+20-201.9 -> 1.10
updown.c+8-81.4 -> 1.5
+1673-964
1 added + 44 modified, total 45 files
Sync to Wine-20040913:
Robert Shearman <rob@codeweavers.com>
- Add 16x16 error, info and warning icons.
- Replace GetWindowLong by GetWindowLongPtr.
- Implement insert marks.
- Rearrange TOOLBAR_INFO.
- Clear data structure after dragging.
- WM_SETCURSOR does not need to be handled as it is not sent whilst
  the window is captured.
- Make uDragListMessage non-static so that we can re-use it
  elsewhere.
- Set class hbrBackground and style to the same as native.
- Set hbrBackground class property to same value as native.
- Use Unicode window functions instead of ANSI.
- Always redraw dialog on changing between pages.
- Set hbrBackground class property to same value as native.
- Remove no longer needed WM_ERASEBKGND handler.
- Use Unicode window functions instead of ANSI.
- Make customization list boxes into drag list boxes.
- Order available buttons in the same way as the native version.
- Obey TBCDRF_NOOFFSET for the button text.
- Make anchor highlighting behave more like native version.
- Don't recalculate toolbar in TOOLBAR_Unkwn460.
- Obey WM_SETREDRAW for the WM_ERASEBKGND message as well as
  WM_PAINT.
- TB_MARKITEM should redraw button.
- Send NM_LDOWN notification.
- NM_RDBLCLK only needs to send a NMHDR structure.
- On mouse notifications returning 0 DefWndProc should be called.
- Fix regression with IE's Menu Bar.
- Implement insert marks.
- Rearrange TOOLBAR_INFO.
- Fix anchor highlighting.
- Remove redundant test in TOOLBAR_DrawButton.
- Status update.
- Remove no longer valid comment.
- Minor coding style cleanups.
- Implement titles.
Hans Leidekker <hans@it.vu.nl>
- Fix signed/unsigned comparison warnings.
Ulrich Czekalla <ulrich@codeweavers.com>
- Forward focus to combobox, otherwise edit control won't get focus.
- The rectangle passed in DRAWITEMSTRUCT is slightly too large as
  compared with Windows.
- Clear tooltip when text is set to NULL.
- Repaint tooltip when item info changes.
Kevin Koltzau <kevin@plop.org>
- Fix bug with chained messages.
- Make SetWindowSubclass behave with SetWindowLong subclasses.
- Allow unlimited number of subclasses.
- Correct issue when SendMessage is called from within a subclass proc.
- Add regression test.
Huw Davies <huw@codeweavers.com>
- Change dialogs to use MS Shell Dlg rather than Helv or MS Sans Serif.
David Kredba <kredba@ibot.cas.cz>
- Added Czech resources.
Vitaliy Margolen <wine-patch@kievinfo.com>
- Send correct tracing notification messages.
Michael Stefaniuc <mstefani@redhat.de>
- Fix hotspot handling
- Remove unused flag from the InternalDrag struct.
Filip Navara <xnavara@volny.cz>
- Status update.
- Fix resizing of wizards.
- Fill the area next to watermark bitmap with window color and subclass
  exterior wizard pages to suppress drawing background.
- Correct displaying of wizard subtitle.
- Do not distinguish exterior wizard pages by their position, but
  instead expect that every page in wizard that doesn't have header is
  exterior.
- Move the property sheet resizing code from PROPSHEET_CreatePage to
  PROPSHEET_SetCurSel. It needs to be executed on every page change
  because the application can modify it during the notifications.
- Draw the Wizard97 header bitmaps before drawing the header strings.
- Center the header bitmap of the new Wizard97 correctly.
- Display the correct wizard title for any wizard type and do not
  change it for reqular property sheets.
- Fix loading wizard title and subtitle from resources.
Mike McCormack <mike@codeweavers.com>
- Calculate the correct size of dialog templates in the propsheet
  control.
Zach Gorman <zach@archetypeauction.com>
- OK button should be default in non-wizard property sheets.
- Propsheet pages need WS_EX_CONTROLPARENT style.
Jon Griffiths <jon_p_griffiths@yahoo.com>
- CreateDCA -> CreateDCW
Vitaliy Margolen <wine-patch@kievinfo.com>
- Make sure TreeView gets redrawn after calling EnsureVisible.

reactos/lib/comctl32
comctl_Cs.rc added at 1.1
diff -N comctl_Cs.rc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ comctl_Cs.rc	19 Sep 2004 09:50:06 -0000	1.1
@@ -0,0 +1,90 @@
+/*
+ * Copyright 1999 Eric Kohl
+ *
+ * Czech resources for comctl32
+ * Copyright 2004 David Kredba
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+LANGUAGE LANG_CZECH, SUBLANG_DEFAULT
+
+IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
+CAPTION "Vlastnosti "
+FONT 8, "MS Shell Dlg"
+BEGIN
+  DEFPUSHBUTTON "OK",     IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP
+  PUSHBUTTON    "Storno", IDCANCEL,58,122,50,14
+  PUSHBUTTON    "&Pou��t", IDC_APPLY_BUTTON,112,122,50,14,WS_DISABLED
+  PUSHBUTTON    "N�pov�da",   IDHELP,166,122,50,14,WS_TABSTOP|WS_GROUP
+  CONTROL       "Tab",    IDC_TABCONTROL,"SysTabControl32",WS_CLIPSIBLINGS|WS_GROUP|WS_TABSTOP|TCS_MULTILINE,4,4,212,114
+END
+
+
+IDD_WIZARD DIALOG DISCARDABLE 0, 0, 290, 159
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
+CAPTION "Pr�vodce"
+FONT 8, "MS Shell Dlg"
+BEGIN
+  DEFPUSHBUTTON "Dokon�it",  IDC_FINISH_BUTTON,121,138,50,14
+  DEFPUSHBUTTON "&Dal�� >", IDC_NEXT_BUTTON,121,138,50,14
+  PUSHBUTTON    "< &Zp�t", IDC_BACK_BUTTON,71,138,50,14
+  PUSHBUTTON    "Storno",  IDCANCEL,178,138,50,14
+  PUSHBUTTON    "N�pov�da",    IDHELP,235,138,50,14,WS_GROUP
+  LTEXT         "",        IDC_SUNKEN_LINE,7,129,278,1,SS_SUNKEN
+  CONTROL       "Tab",     IDC_TABCONTROL,"SysTabControl32",WS_CLIPSIBLINGS | WS_DISABLED,7,7,258,5
+  LTEXT	        "",        IDC_SUNKEN_LINEHEADER,0,35,290,1,SS_LEFT | SS_SUNKEN | WS_CHILD | WS_VISIBLE
+END
+
+
+IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10, 20, 357, 125
+STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION "Nastaven� panelu"
+FONT 8, "MS Shell Dlg"
+BEGIN
+  DEFPUSHBUTTON "&Zav��t",     IDCANCEL,308,6,44,14
+  PUSHBUTTON    "&V�choz�",     IDC_RESET_BTN,308,23,44,14
+  PUSHBUTTON    "&N�pov�da",      IDC_HELP_BTN,308,40,44,14
+  PUSHBUTTON    "Nahor&u",   IDC_MOVEUP_BTN,308,74,44,14
+  PUSHBUTTON    "&Dol�", IDC_MOVEDN_BTN,308,91,44,14
+  LTEXT         "D&ostupn� tla��tka:", -1,4,5,84,10
+  LISTBOX       IDC_AVAILBTN_LBOX,4,17,120,100, LBS_NOTIFY | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
+  PUSHBUTTON    "P�id&at ->",    IDOK, 131, 42, 44, 14
+  PUSHBUTTON    "<- Odeb&rat", IDC_REMOVE_BTN,131,62,44,14
+  LTEXT         "&Tla��tka panelu:", -1,182,5,78,10
+  LISTBOX       IDC_TOOLBARBTN_LBOX, 182,17,120,100,LBS_NOTIFY | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
+END
+
+STRINGTABLE DISCARDABLE
+{
+    IDS_CLOSE    "Zav��t"
+}
+
+STRINGTABLE DISCARDABLE
+{
+    IDM_TODAY    "Dnes:"
+    IDM_GOTODAY  "Jdi na dne�ek"
+}
+
+STRINGTABLE DISCARDABLE
+{
+    IDS_SEPARATOR "Odd�lova�"
+}
+
+STRINGTABLE DISCARDABLE
+{
+    HKY_NONE "��dn�"
+}

reactos/lib/comctl32
.cvsignore 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- .cvsignore	15 Apr 2004 08:29:56 -0000	1.5
+++ .cvsignore	19 Sep 2004 09:50:05 -0000	1.6
@@ -18,5 +18,8 @@
 idc_divideropen.cur
 idc_movebutton.cur
 idi_dragarrow.ico
+idi_tt_error_sm.ico
+idi_tt_info_sm.ico
+idi_tt_warn_sm.ico
 idt_check.bmp
 comctl32.spec.def

reactos/lib/comctl32
Makefile.in 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- Makefile.in	9 Aug 2004 15:35:58 -0000	1.5
+++ Makefile.in	19 Sep 2004 09:50:05 -0000	1.6
@@ -52,6 +52,9 @@
 	idc_divideropen.cur \
 	idc_movebutton.cur \
 	idi_dragarrow.ico \
+	idi_tt_error_sm.ico \
+	idi_tt_info_sm.ico \
+	idi_tt_warn_sm.ico \
 	idt_check.bmp
 
 SUBDIRS = tests

reactos/lib/comctl32
animate.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- animate.c	15 Apr 2004 08:29:56 -0000	1.5
+++ animate.c	19 Sep 2004 09:50:05 -0000	1.6
@@ -85,7 +85,7 @@
    HBITMAP  	    	hbmPrevFrame;
 } ANIMATE_INFO;
 
-#define ANIMATE_GetInfoPtr(hWnd) ((ANIMATE_INFO *)GetWindowLongA(hWnd, 0))
+#define ANIMATE_GetInfoPtr(hWnd) ((ANIMATE_INFO *)GetWindowLongPtrW(hWnd, 0))
 #define ANIMATE_COLOR_NONE  	0xffffffff
 
 static void ANIMATE_Notify(ANIMATE_INFO* infoPtr, UINT notif)
@@ -704,7 +704,7 @@
     }
 
     if (!hInstance)
-       hInstance = (HINSTANCE)GetWindowLongA(hWnd, GWL_HINSTANCE);
+       hInstance = (HINSTANCE)GetWindowLongPtrW(hWnd, GWLP_HINSTANCE);
 
     if (HIWORD(lParam)) {
 	TRACE("(\"%s\");\n", (LPSTR)lParam);
@@ -794,13 +794,13 @@
     }
 
     /* store crossref hWnd <-> info structure */
-    SetWindowLongA(hWnd, 0, (DWORD)infoPtr);
+    SetWindowLongPtrW(hWnd, 0, (DWORD_PTR)infoPtr);
     infoPtr->hwndSelf = hWnd;
     infoPtr->hwndNotify = ((LPCREATESTRUCTA)lParam)->hwndParent;
     infoPtr->transparentColor = ANIMATE_COLOR_NONE;
     infoPtr->hbmPrevFrame = 0;
 
-    TRACE("Animate style=0x%08lx, parent=%08lx\n", GetWindowLongA(hWnd, GWL_STYLE), (DWORD)infoPtr->hwndNotify);
+    TRACE("Animate style=0x%08lx, parent=%p\n", GetWindowLongA(hWnd, GWL_STYLE), infoPtr->hwndNotify);
 
     InitializeCriticalSection(&infoPtr->cs);
 
@@ -818,7 +818,7 @@
 
     /* free animate info data */
     Free(infoPtr);
-    SetWindowLongA(hWnd, 0, 0);
+    SetWindowLongPtrW(hWnd, 0, 0);
 
     return 0;
 }

reactos/lib/comctl32
comboex.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- comboex.c	8 May 2004 11:41:04 -0000	1.5
+++ comboex.c	19 Sep 2004 09:50:05 -0000	1.6
@@ -122,7 +122,7 @@
 #define CBE_SEP			4
 
 #define COMBOEX_SUBCLASS_PROP	"CCComboEx32SubclassInfo"
-#define COMBOEX_GetInfoPtr(hwnd) ((COMBOEX_INFO *)GetWindowLongW (hwnd, 0))
+#define COMBOEX_GetInfoPtr(hwnd) ((COMBOEX_INFO *)GetWindowLongPtrW (hwnd, 0))
 
 
 /* Things common to the entire DLL */
@@ -400,14 +400,14 @@
 static void COMBOEX_ReSize (COMBOEX_INFO *infoPtr)
 {
     SIZE mysize;
-    UINT cy;
+    LONG cy;
     IMAGEINFO iinfo;
 
     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("upgraded height due to image:  height=%d\n", cy);
+	TRACE("upgraded height due to image:  height=%ld\n", cy);
     }
     SendMessageW (infoPtr->hwndSelf, CB_SETITEMHEIGHT, (WPARAM)-1, (LPARAM)cy);
     if (infoPtr->hwndCombo) {
@@ -943,7 +943,7 @@
     }
     infoPtr->NtfUnicode = (i == NFR_UNICODE);
 
-    SetWindowLongW (hwnd, 0, (DWORD)infoPtr);
+    SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
 
     /* create combo box */
     GetWindowRect(hwnd, &wnrc1);
@@ -967,8 +967,8 @@
 			 WS_CHILD | WS_VISIBLE | CBS_OWNERDRAWFIXED |
 			 GetWindowLongW (hwnd, GWL_STYLE),
 			 cs->y, cs->x, cs->cx, cs->cy, hwnd,
-			 (HMENU) GetWindowLongW (hwnd, GWL_ID),
-			 (HINSTANCE)GetWindowLongW (hwnd, GWL_HINSTANCE), NULL);
+			 (HMENU) GetWindowLongPtrW (hwnd, GWLP_ID),
+			 (HINSTANCE)GetWindowLongPtrW (hwnd, GWLP_HINSTANCE), NULL);
 
     /*
      * native does the following at this point according to trace:
@@ -983,8 +983,8 @@
      * data structure.
      */
     SetPropA(infoPtr->hwndCombo, COMBOEX_SUBCLASS_PROP, hwnd);
-    infoPtr->prevComboWndProc = (WNDPROC)SetWindowLongW(infoPtr->hwndCombo,
-	                        GWL_WNDPROC, (LONG)COMBOEX_ComboWndProc);
+    infoPtr->prevComboWndProc = (WNDPROC)SetWindowLongPtrW(infoPtr->hwndCombo,
+	                        GWLP_WNDPROC, (DWORD_PTR)COMBOEX_ComboWndProc);
     infoPtr->font = (HFONT)SendMessageW (infoPtr->hwndCombo, WM_GETFONT, 0, 0);
 
 
@@ -997,8 +997,8 @@
 		    WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | ES_AUTOHSCROLL,
 		    0, 0, 0, 0,  /* will set later */
 		    infoPtr->hwndCombo,
-		    (HMENU) GetWindowLongW (hwnd, GWL_ID),
-		    (HINSTANCE)GetWindowLongW (hwnd, GWL_HINSTANCE), NULL);
+		    (HMENU) GetWindowLongPtrW (hwnd, GWLP_ID),
+		    (HINSTANCE)GetWindowLongPtrW (hwnd, GWLP_HINSTANCE), NULL);
 
 	/* native does the following at this point according to trace:
 	 *  GetWindowThreadProcessId(hwndEdit,0)
@@ -1012,8 +1012,8 @@
 	 * data structure.
 	 */
         SetPropA(infoPtr->hwndEdit, COMBOEX_SUBCLASS_PROP, hwnd);
-	infoPtr->prevEditWndProc = (WNDPROC)SetWindowLongW(infoPtr->hwndEdit,
-				 GWL_WNDPROC, (LONG)COMBOEX_EditWndProc);
+	infoPtr->prevEditWndProc = (WNDPROC)SetWindowLongPtrW(infoPtr->hwndEdit,
+				 GWLP_WNDPROC, (DWORD_PTR)COMBOEX_EditWndProc);
 	infoPtr->font = (HFONT)SendMessageW(infoPtr->hwndCombo, WM_GETFONT, 0, 0);
     }
 
@@ -1546,7 +1546,7 @@
 
     /* free comboex info data */
     Free (infoPtr);
-    SetWindowLongW (infoPtr->hwndSelf, 0, 0);
+    SetWindowLongPtrW (infoPtr->hwndSelf, 0, 0);
     return 0;
 }
 
@@ -1610,7 +1610,7 @@
 static LRESULT COMBOEX_WindowPosChanging (COMBOEX_INFO *infoPtr, WINDOWPOS *wp)
 {
     RECT cbx_wrect, cbx_crect, cb_wrect;
-    UINT width, height;
+    INT width, height;
 
     GetWindowRect (infoPtr->hwndSelf, &cbx_wrect);
     GetClientRect (infoPtr->hwndSelf, &cbx_crect);
@@ -2263,6 +2263,10 @@
         case WM_WINDOWPOSCHANGING:
 	    return COMBOEX_WindowPosChanging (infoPtr, (WINDOWPOS *)lParam);
 
+        case WM_SETFOCUS:
+            SetFocus(infoPtr->hwndCombo);
+            return 0;
+
 	default:
 	    if ((uMsg >= WM_USER) && (uMsg < WM_APP))
 		ERR("unknown msg %04x wp=%08x lp=%08lx\n",uMsg,wParam,lParam);

reactos/lib/comctl32
comctl32.h 1.8 -> 1.9
diff -u -r1.8 -r1.9
--- comctl32.h	16 Jun 2004 06:46:13 -0000	1.8
+++ comctl32.h	19 Sep 2004 09:50:06 -0000	1.9
@@ -112,6 +112,11 @@
 /* HOTKEY internal strings */
 #define HKY_NONE                        2048
 
+/* Tooltip icons */
+#define IDI_TT_INFO_SM                   22
+#define IDI_TT_WARN_SM                   25
+#define IDI_TT_ERROR_SM                  28
+
 typedef struct
 {
     COLORREF clrBtnHighlight;       /* COLOR_BTNHIGHLIGHT                  */
@@ -137,6 +142,7 @@
 /* Internal function */
 HWND COMCTL32_CreateToolTip (HWND);
 VOID COMCTL32_RefreshSysColors(void);
+void COMCTL32_DrawInsertMark(HDC hDC, const RECT *lpRect, COLORREF clrInsertMark, BOOL bHorizontal);
 INT  Str_GetPtrWtoA (LPCWSTR lpSrc, LPSTR lpDest, INT nMaxLen);
 BOOL Str_SetPtrAtoW (LPWSTR *lppDest, LPCSTR lpSrc);
 
@@ -145,17 +151,19 @@
 #define WINE_FILEVERSIONSTR "5.80"
 
 /* Our internal stack structure of the window procedures to subclass */
+typedef struct _SUBCLASSPROCS {
+    SUBCLASSPROC subproc;
+    UINT_PTR id;
+    DWORD_PTR ref;
+    struct _SUBCLASSPROCS *next;
+} SUBCLASSPROCS, *LPSUBCLASSPROCS;
+
 typedef struct
 {
-   struct {
-      SUBCLASSPROC subproc;
-      UINT_PTR id;
-      DWORD_PTR ref;
-   } SubclassProcs[31];
-   int stackpos;
-   int stacknum;
-   int wndprocrecursion;
+   SUBCLASSPROCS *SubclassProcs;
+   SUBCLASSPROCS *stackpos;
    WNDPROC origproc;
+   int running;
 } SUBCLASS_INFO, *LPSUBCLASS_INFO;
 
 /* undocumented functions */

reactos/lib/comctl32
comctl32undoc.c 1.8 -> 1.9
diff -u -r1.8 -r1.9
--- comctl32undoc.c	8 May 2004 11:41:04 -0000	1.8
+++ comctl32undoc.c	19 Sep 2004 09:50:06 -0000	1.9
@@ -631,7 +631,8 @@
 FindMRUData (HANDLE hList, LPCVOID lpData, DWORD cbData, LPINT lpRegNum)
 {
     LPWINEMRULIST mp = (LPWINEMRULIST)hList;
-    UINT i, ret;
+    INT ret;
+    UINT i;
     LPSTR dataA = NULL;
 
     if (!mp->extview.lpfnCompare) {

reactos/lib/comctl32
comctl_Cn.rc 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- comctl_Cn.rc	16 Jun 2004 06:46:13 -0000	1.3
+++ comctl_Cn.rc	19 Sep 2004 09:50:06 -0000	1.4
@@ -22,7 +22,7 @@
 IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
 CAPTION "���� "
-FONT 8, "MS Sans Serif"
+FONT 8, "MS Shell Dlg"
 BEGIN
   DEFPUSHBUTTON "����",     IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP
   PUSHBUTTON    "����", IDCANCEL,58,122,50,14
@@ -35,7 +35,7 @@
 IDD_WIZARD DIALOG DISCARDABLE 0, 0, 290, 159
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
 CAPTION "Wizard"
-FONT 8, "MS Sans Serif"
+FONT 8, "MS Shell Dlg"
 BEGIN
   DEFPUSHBUTTON "����",  IDC_FINISH_BUTTON,121,138,50,14
   DEFPUSHBUTTON "������(&N) >", IDC_NEXT_BUTTON,121,138,50,14
@@ -51,7 +51,7 @@
 IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10, 20, 357, 125
 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
 CAPTION "������������"
-FONT 8, "MS Sans Serif"
+FONT 8, "MS Shell Dlg"
 BEGIN
   DEFPUSHBUTTON "����(&C)",     IDCANCEL,308,6,44,14
   PUSHBUTTON    "����(&e)",     IDC_RESET_BTN,308,23,44,14

reactos/lib/comctl32
comctl_De.rc 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- comctl_De.rc	9 Aug 2004 15:07:37 -0000	1.4
+++ comctl_De.rc	19 Sep 2004 09:50:06 -0000	1.5
@@ -42,7 +42,7 @@
 IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
 CAPTION "Eigenschaften f�r "
-FONT 8, "MS Sans Serif"
+FONT 8, "MS Shell Dlg"
 BEGIN
   DEFPUSHBUTTON "&OK",        IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP
   PUSHBUTTON    "A&bbrechen", IDCANCEL,58,122,50,14
@@ -55,7 +55,7 @@
 IDD_WIZARD DIALOG DISCARDABLE 0, 0, 290, 159
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
 CAPTION "Wizard"
-FONT 8, "MS Sans Serif"
+FONT 8, "MS Shell Dlg"
 BEGIN
   DEFPUSHBUTTON "&Beenden",   IDC_FINISH_BUTTON,121,138,50,14
   DEFPUSHBUTTON "&Weiter >", IDC_NEXT_BUTTON,121,138,50,14
@@ -71,7 +71,7 @@
 IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10, 20, 357, 125
 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
 CAPTION "Toolbar einrichten"
-FONT 8, "MS Sans Serif"
+FONT 8, "MS Shell Dlg"
 BEGIN
   DEFPUSHBUTTON "&Schlie�en",               IDCANCEL,308,6,44,14
   PUSHBUTTON    "&Zur�cksetzen",            IDC_RESET_BTN,308,23,44,14

reactos/lib/comctl32
comctl_En.rc 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- comctl_En.rc	16 Jun 2004 06:46:13 -0000	1.3
+++ comctl_En.rc	19 Sep 2004 09:50:06 -0000	1.4
@@ -21,7 +21,7 @@
 IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
 CAPTION "Properties for "
-FONT 8, "MS Sans Serif"
+FONT 8, "MS Shell Dlg"
 BEGIN
   DEFPUSHBUTTON "OK",     IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP
   PUSHBUTTON    "Cancel", IDCANCEL,58,122,50,14
@@ -34,7 +34,7 @@
 IDD_WIZARD DIALOG DISCARDABLE 0, 0, 290, 159
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
 CAPTION "Wizard"
-FONT 8, "MS Sans Serif"
+FONT 8, "MS Shell Dlg"
 BEGIN
   DEFPUSHBUTTON "Finish",  IDC_FINISH_BUTTON,121,138,50,14
   DEFPUSHBUTTON "&Next >", IDC_NEXT_BUTTON,121,138,50,14
@@ -50,7 +50,7 @@
 IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10, 20, 357, 125
 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
 CAPTION "Customize Toolbar"
-FONT 8, "MS Sans Serif"
+FONT 8, "MS Shell Dlg"
 BEGIN
   DEFPUSHBUTTON "&Close",     IDCANCEL,308,6,44,14
   PUSHBUTTON    "R&eset",     IDC_RESET_BTN,308,23,44,14

reactos/lib/comctl32
comctl_Es.rc 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- comctl_Es.rc	16 Jun 2004 06:46:13 -0000	1.3
+++ comctl_Es.rc	19 Sep 2004 09:50:06 -0000	1.4
@@ -21,7 +21,7 @@
 IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
 CAPTION "Propiedades de "
-FONT 8, "MS Sans Serif"
+FONT 8, "MS Shell Dlg"
 BEGIN
   DEFPUSHBUTTON "Aceptar",  IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP
   PUSHBUTTON    "Cancelar", IDCANCEL,58,122,50,14
@@ -34,7 +34,7 @@
 IDD_WIZARD DIALOG DISCARDABLE 0, 0, 290, 159
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
 CAPTION "Ayudante"
-FONT 8, "MS Sans Serif"
+FONT 8, "MS Shell Dlg"
 BEGIN
   DEFPUSHBUTTON "Terminar",     IDC_FINISH_BUTTON,121,138,50,14
   DEFPUSHBUTTON "&Siguiente >", IDC_NEXT_BUTTON,121,138,50,14
@@ -50,7 +50,7 @@
 IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10, 20, 357, 125
 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
 CAPTION "Personalizar barra de herramientas"
-FONT 8, "MS Sans Serif"
+FONT 8, "MS Shell Dlg"
 BEGIN
   DEFPUSHBUTTON "&Cerrar",       IDCANCEL,308,6,44,14
   PUSHBUTTON    "R&estaurar",    IDC_RESET_BTN,308,23,44,14

reactos/lib/comctl32
comctl_Fr.rc 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- comctl_Fr.rc	16 Jun 2004 06:46:13 -0000	1.3
+++ comctl_Fr.rc	19 Sep 2004 09:50:06 -0000	1.4
@@ -25,7 +25,7 @@
 IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
 CAPTION "Propri�t�s pour "
-FONT 8, "MS Sans Serif"
+FONT 8, "MS Shell Dlg"
 BEGIN
   DEFPUSHBUTTON "OK",     IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP
   PUSHBUTTON    "Annuler", IDCANCEL,58,122,50,14
@@ -38,7 +38,7 @@
 IDD_WIZARD DIALOG DISCARDABLE 0, 0, 290, 159
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
 CAPTION "Assistant"
-FONT 8, "MS Sans Serif"
+FONT 8, "MS Shell Dlg"
 BEGIN
   DEFPUSHBUTTON "Terminer", IDC_FINISH_BUTTON,121,138,50,14
   DEFPUSHBUTTON "&Suivant >", IDC_NEXT_BUTTON,121,138,50,14
@@ -54,7 +54,7 @@
 IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10, 20, 357, 125
 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
 CAPTION "Personnaliser la barre d'outils"
-FONT 8, "MS Sans Serif"
+FONT 8, "MS Shell Dlg"
 BEGIN
   DEFPUSHBUTTON "&Fermer",  IDCANCEL,308,6,44,14
   PUSHBUTTON    "&R�initialiser", IDC_RESET_BTN,308,23,44,14

reactos/lib/comctl32
comctl_It.rc 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- comctl_It.rc	16 Jun 2004 06:46:13 -0000	1.3
+++ comctl_It.rc	19 Sep 2004 09:50:06 -0000	1.4
@@ -22,7 +22,7 @@
 IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
 CAPTION "Propriet� per "
-FONT 8, "MS Sans Serif"
+FONT 8, "MS Shell Dlg"
 BEGIN
   DEFPUSHBUTTON "OK",     IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP
   PUSHBUTTON    "Annulla", IDCANCEL,58,122,50,14
@@ -35,7 +35,7 @@
 IDD_WIZARD DIALOG DISCARDABLE 0, 0, 290, 159
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
 CAPTION "Wizard"
-FONT 8, "MS Sans Serif"
+FONT 8, "MS Shell Dlg"
 BEGIN
   DEFPUSHBUTTON "Fine",  IDC_FINISH_BUTTON,121,138,50,14
   DEFPUSHBUTTON "&Avanti >", IDC_NEXT_BUTTON,121,138,50,14
@@ -51,7 +51,7 @@
 IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10, 20, 357, 125
 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
 CAPTION "Personalitta la barra degli strumenti"
-FONT 8, "MS Sans Serif"
+FONT 8, "MS Shell Dlg"
 BEGIN
   DEFPUSHBUTTON "&Chiudi",     IDCANCEL,308,6,44,14
   PUSHBUTTON    "R&eimpostare",     IDC_RESET_BTN,308,23,44,14

reactos/lib/comctl32
comctl_Ko.rc 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- comctl_Ko.rc	16 Jun 2004 06:46:13 -0000	1.3
+++ comctl_Ko.rc	19 Sep 2004 09:50:06 -0000	1.4
@@ -21,7 +21,7 @@
 IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
 CAPTION "Properties for "
-FONT 9, "MS Sans Serif"
+FONT 9, "MS Shell Dlg"
 BEGIN
   DEFPUSHBUTTON "����",     IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP
   PUSHBUTTON    "����", IDCANCEL,58,122,50,14
@@ -34,7 +34,7 @@
 IDD_WIZARD DIALOG DISCARDABLE 0, 0, 290, 159
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
 CAPTION "Wizard"
-FONT 9, "MS Sans Serif"
+FONT 9, "MS Shell Dlg"
 BEGIN
   DEFPUSHBUTTON "����",  IDC_FINISH_BUTTON,121,138,50,14
   DEFPUSHBUTTON "����(&N) >", IDC_NEXT_BUTTON,121,138,50,14
@@ -50,7 +50,7 @@
 IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10, 20, 357, 125
 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
 CAPTION "Customize Toolbar"
-FONT 9, "MS Sans Serif"
+FONT 9, "MS Shell Dlg"
 BEGIN
   DEFPUSHBUTTON "����(&C)",     IDCANCEL,308,6,44,14
   PUSHBUTTON    "����(&e)",     IDC_RESET_BTN,308,23,44,14

reactos/lib/comctl32
comctl_Nl.rc 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- comctl_Nl.rc	16 Jun 2004 06:46:13 -0000	1.3
+++ comctl_Nl.rc	19 Sep 2004 09:50:06 -0000	1.4
@@ -23,7 +23,7 @@
 IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
 CAPTION "Eigenschappen van "
-FONT 8, "MS Sans Serif"
+FONT 8, "MS Shell Dlg"
 BEGIN
   DEFPUSHBUTTON "OK",         IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP
   PUSHBUTTON    "Annuleren",  IDCANCEL,58,122,50,14
@@ -36,7 +36,7 @@
 IDD_WIZARD DIALOG DISCARDABLE 0, 0, 290, 159
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
 CAPTION "Assistent"
-FONT 8, "MS Sans Serif"
+FONT 8, "MS Shell Dlg"
 BEGIN
   DEFPUSHBUTTON "Be��indigen",  IDC_FINISH_BUTTON,121,138,50,14
   DEFPUSHBUTTON "&Volgende >", IDC_NEXT_BUTTON,121,138,50,14
@@ -52,7 +52,7 @@
 IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10, 20, 357, 125
 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
 CAPTION "Gereedschappenbalk aanpassen"
-FONT 8, "MS Sans Serif"
+FONT 8, "MS Shell Dlg"
 BEGIN
   DEFPUSHBUTTON "&Afsluiten",           IDCANCEL,308,6,44,14
   PUSHBUTTON    "&Reset",               IDC_RESET_BTN,308,23,44,14

reactos/lib/comctl32
comctl_Pl.rc 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- comctl_Pl.rc	16 Jun 2004 06:46:13 -0000	1.3
+++ comctl_Pl.rc	19 Sep 2004 09:50:06 -0000	1.4
@@ -22,7 +22,7 @@
 IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
 CAPTION "W�a�ciwo�ci "
-FONT 8, "MS Sans Serif"
+FONT 8, "MS Shell Dlg"
 BEGIN
   DEFPUSHBUTTON "OK",     IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP
   PUSHBUTTON    "Anuluj", IDCANCEL,58,122,50,14
@@ -35,7 +35,7 @@
 IDD_WIZARD DIALOG DISCARDABLE 0, 0, 290, 159
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
 CAPTION "Kreator"
-FONT 8, "MS Sans Serif"
+FONT 8, "MS Shell Dlg"
 BEGIN
   DEFPUSHBUTTON "Zako�cz",  IDC_FINISH_BUTTON,121,138,50,14
   DEFPUSHBUTTON "&Dalej >", IDC_NEXT_BUTTON,121,138,50,14
@@ -51,7 +51,7 @@
 IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10, 20, 357, 125
 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
 CAPTION "Dostosowywanie paska narz�dzi"
-FONT 8, "MS Sans Serif"
+FONT 8, "MS Shell Dlg"
 BEGIN
   DEFPUSHBUTTON "&Zamknij",     IDCANCEL,308,6,44,14
   PUSHBUTTON    "Z&resetuj",     IDC_RESET_BTN,308,23,44,14

reactos/lib/comctl32
comctl_Pt.rc 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- comctl_Pt.rc	16 Jun 2004 06:46:13 -0000	1.3
+++ comctl_Pt.rc	19 Sep 2004 09:50:06 -0000	1.4
@@ -21,7 +21,7 @@
 IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
 CAPTION "Propriedades para "
-FONT 8, "MS Sans Serif"
+FONT 8, "MS Shell Dlg"
 BEGIN
   DEFPUSHBUTTON "OK",     IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP
   PUSHBUTTON    "Cancelar", IDCANCEL,58,122,50,14
@@ -34,7 +34,7 @@
 IDD_WIZARD DIALOG DISCARDABLE 0, 0, 290, 159
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
 CAPTION "Assistente"
-FONT 8, "MS Sans Serif"
+FONT 8, "MS Shell Dlg"
 BEGIN
   DEFPUSHBUTTON "Finalizar",  IDC_FINISH_BUTTON,121,138,50,14
   DEFPUSHBUTTON "&Avan�ar >", IDC_NEXT_BUTTON,121,138,50,14
@@ -50,7 +50,7 @@
 IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10, 20, 357, 125
 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
 CAPTION "Personalizar barra de ferramentas"
-FONT 8, "MS Sans Serif"
+FONT 8, "MS Shell Dlg"
 BEGIN
   DEFPUSHBUTTON "&Fechar",     IDCANCEL,308,6,44,14
   PUSHBUTTON    "R&estaurar",     IDC_RESET_BTN,308,23,44,14

reactos/lib/comctl32
comctl_Ru.rc 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- comctl_Ru.rc	16 Jun 2004 06:46:13 -0000	1.3
+++ comctl_Ru.rc	19 Sep 2004 09:50:06 -0000	1.4
@@ -23,7 +23,7 @@
 IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
 CAPTION "�������� ��� "
-FONT 8, "MS Sans Serif"
+FONT 8, "MS Shell Dlg"
 BEGIN
   DEFPUSHBUTTON "OK",     IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP
   PUSHBUTTON    "������", IDCANCEL,58,122,50,14
@@ -36,7 +36,7 @@
 IDD_WIZARD DIALOG DISCARDABLE 0, 0, 290, 159
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
 CAPTION "������"
-FONT 8, "MS Sans Serif"
+FONT 8, "MS Shell Dlg"
 BEGIN
   DEFPUSHBUTTON "���������",  IDC_FINISH_BUTTON,121,138,50,14
   DEFPUSHBUTTON "&����� >", IDC_NEXT_BUTTON,121,138,50,14
@@ -52,7 +52,7 @@
 IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10, 20, 357, 125
 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
 CAPTION "��������� ������ ������������"
-FONT 8, "MS Sans Serif"
+FONT 8, "MS Shell Dlg"
 BEGIN
   DEFPUSHBUTTON "&�������",     IDCANCEL,308,6,44,14
   PUSHBUTTON    "�&�������",     IDC_RESET_BTN,308,23,44,14

reactos/lib/comctl32
comctl_Si.rc 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- comctl_Si.rc	16 Jun 2004 06:46:13 -0000	1.3
+++ comctl_Si.rc	19 Sep 2004 09:50:06 -0000	1.4
@@ -21,7 +21,7 @@
 IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
 CAPTION "Lastnosti"
-FONT 8, "MS Sans Serif"
+FONT 8, "MS Shell Dlg"
 BEGIN
   DEFPUSHBUTTON "V redu",     IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP
   PUSHBUTTON    "Prekli�i", IDCANCEL,58,122,50,14
@@ -34,7 +34,7 @@
 IDD_WIZARD DIALOG DISCARDABLE 0, 0, 290, 159
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
 CAPTION "�arovnik"
-FONT 8, "MS Sans Serif"
+FONT 8, "MS Shell Dlg"
 BEGIN
   DEFPUSHBUTTON "Dokon�aj",  IDC_FINISH_BUTTON,121,138,50,14
   DEFPUSHBUTTON "Naprej >", IDC_NEXT_BUTTON,121,138,50,14
@@ -50,7 +50,7 @@
 IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10, 20, 357, 125
 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
 CAPTION "Prilagoditev orodne vrstice"
-FONT 8, "MS Sans Serif"
+FONT 8, "MS Shell Dlg"
 BEGIN
   DEFPUSHBUTTON "&Zapri",     IDCANCEL,308,6,44,14
   PUSHBUTTON    "Po&nastavi",     IDC_RESET_BTN,308,23,44,14

reactos/lib/comctl32
comctl_Th.rc 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- comctl_Th.rc	16 Jun 2004 06:46:13 -0000	1.3
+++ comctl_Th.rc	19 Sep 2004 09:50:06 -0000	1.4
@@ -21,7 +21,7 @@
 IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
 CAPTION "������������ "
-FONT 8, "MS Sans Serif"
+FONT 8, "MS Shell Dlg"
 BEGIN
   DEFPUSHBUTTON "����",     IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP
   PUSHBUTTON    "������", IDCANCEL,58,122,50,14
@@ -34,7 +34,7 @@
 IDD_WIZARD DIALOG DISCARDABLE 0, 0, 290, 159
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
 CAPTION "Wizard"
-FONT 8, "MS Sans Serif"
+FONT 8, "MS Shell Dlg"
 BEGIN
   DEFPUSHBUTTON "�����������",  IDC_FINISH_BUTTON,121,138,50,14
   DEFPUSHBUTTON "����� >", IDC_NEXT_BUTTON,121,138,50,14
@@ -50,7 +50,7 @@
 IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10, 20, 357, 125
 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
 CAPTION "���������������������"
-FONT 8, "MS Sans Serif"
+FONT 8, "MS Shell Dlg"
 BEGIN
   DEFPUSHBUTTON "���",     IDCANCEL,308,6,44,14
   PUSHBUTTON    "������",     IDC_RESET_BTN,308,23,44,14

reactos/lib/comctl32
comctl_Uk.rc 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- comctl_Uk.rc	16 Jun 2004 06:46:13 -0000	1.2
+++ comctl_Uk.rc	19 Sep 2004 09:50:06 -0000	1.3
@@ -23,7 +23,7 @@
 IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
 CAPTION "����������� ��� "
-FONT 8, "MS Sans Serif"
+FONT 8, "MS Shell Dlg"
 BEGIN
   DEFPUSHBUTTON "OK",     IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP
   PUSHBUTTON    "&�������", IDCANCEL,58,122,50,14
@@ -36,7 +36,7 @@
 IDD_WIZARD DIALOG DISCARDABLE 0, 0, 290, 159
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
 CAPTION "������"
-FONT 8, "MS Sans Serif"
+FONT 8, "MS Shell Dlg"
 BEGIN
   DEFPUSHBUTTON "&���������",  IDC_FINISH_BUTTON,121,138,50,14
   DEFPUSHBUTTON "&���� >", IDC_NEXT_BUTTON,121,138,50,14
@@ -52,7 +52,7 @@
 IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10, 20, 357, 125
 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
 CAPTION "��������� ������ ������������"
-FONT 8, "MS Sans Serif"
+FONT 8, "MS Shell Dlg"
 BEGIN
   DEFPUSHBUTTON "&�������",     IDCANCEL,308,6,44,14
   PUSHBUTTON    "&�������",     IDC_RESET_BTN,308,23,44,14

reactos/lib/comctl32
commctrl.c 1.15 -> 1.16
diff -u -r1.15 -r1.16
--- commctrl.c	9 Aug 2004 15:35:58 -0000	1.15
+++ commctrl.c	19 Sep 2004 09:50:06 -0000	1.16
@@ -116,6 +116,7 @@
 extern void UPDOWN_Register(void);
 extern void UPDOWN_Unregister(void);
 
+LRESULT WINAPI COMCTL32_SubclassProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
 
 LPSTR    COMCTL32_aSubclass = NULL;
 HMODULE COMCTL32_hModule = 0;
@@ -831,9 +832,9 @@
     HGLOBAL hglb;
     HRSRC hRsrc;
     LPBITMAPINFOHEADER lpBitmap, lpBitmapInfo;
-    UINT nSize, nColorTableSize;
+    UINT nSize, nColorTableSize, iColor;
     RGBQUAD *pColorTable;
-    INT iColor, i, iMaps, nWidth, nHeight;
+    INT i, iMaps, nWidth, nHeight;
     HDC hdcScreen;
     HBITMAP hbm;
     LPCOLORMAP sysColorMap;
@@ -1092,7 +1093,7 @@
                         UINT_PTR uIDSubclass, DWORD_PTR dwRef)
 {
    LPSUBCLASS_INFO stack;
-   int n;
+   LPSUBCLASSPROCS proc;
 
    TRACE ("(%p, %p, %x, %lx)\n", hWnd, pfnSubclass, uIDSubclass, dwRef);
 
@@ -1115,49 +1116,44 @@
 
       /* set window procedure to our own and save the current one */
       if (IsWindowUnicode (hWnd))
-         stack->origproc = (WNDPROC)SetWindowLongW (hWnd, GWL_WNDPROC,
-                                                   (LONG)DefSubclassProc);
+         stack->origproc = (WNDPROC)SetWindowLongPtrW (hWnd, GWLP_WNDPROC,
+                                                   (DWORD_PTR)COMCTL32_SubclassProc);
       else
-         stack->origproc = (WNDPROC)SetWindowLongA (hWnd, GWL_WNDPROC,
-                                                   (LONG)DefSubclassProc);
-   } else {
-      WNDPROC current;
-      if (IsWindowUnicode (hWnd))
-         current = (WNDPROC)GetWindowLongW (hWnd, GWL_WNDPROC);
-      else
-         current = (WNDPROC)GetWindowLongA (hWnd, GWL_WNDPROC);
-
-      if (current != DefSubclassProc) {
-         ERR ("Application has subclassed with our procedure, then manually, then with us again.  The current implementation can't handle this.\n");
-         return FALSE;
-      }
+         stack->origproc = (WNDPROC)SetWindowLongPtrA (hWnd, GWLP_WNDPROC,
+                                                   (DWORD_PTR)COMCTL32_SubclassProc);
    }
-
-   /* Check to see if we have called this function with the same uIDSubClass
-    * and pfnSubclass */
-   for (n = 0; n < stack->stacknum; n++)
-      if ((stack->SubclassProcs[n].id == uIDSubclass) && 
-         (stack->SubclassProcs[n].subproc == pfnSubclass)) {
-         stack->SubclassProcs[n].ref = dwRef;
-         return TRUE;
+   else {
+      /* Check to see if we have called this function with the same uIDSubClass
+       * and pfnSubclass */
+      proc = stack->SubclassProcs;
+      while (proc) {
+         if ((proc->id == uIDSubclass) &&
+            (proc->subproc == pfnSubclass)) {
+            proc->ref = dwRef;
+            return TRUE;
+         }
+         proc = proc->next;
       }
-
-   if (stack->stacknum >= 32) {
-      ERR ("We have a Subclass stack overflow, please increment size\n");
+   }
+   
+   proc = HeapAlloc(GetProcessHeap(), 0, sizeof(SUBCLASSPROCS));
+   if (!proc) {
+      ERR ("Failed to allocate subclass entry in stack\n");
+      if (IsWindowUnicode (hWnd))
+         SetWindowLongPtrW (hWnd, GWLP_WNDPROC, (DWORD_PTR)stack->origproc);
+      else
+         SetWindowLongPtrA (hWnd, GWLP_WNDPROC, (DWORD_PTR)stack->origproc);
+      HeapFree (GetProcessHeap (), 0, stack);
+      RemovePropA( hWnd, COMCTL32_aSubclass );
       return FALSE;
    }
-
-   memmove (&stack->SubclassProcs[1], &stack->SubclassProcs[0],
-            sizeof(stack->SubclassProcs[0]) * stack->stacknum);
-
-   stack->stacknum++;
-   if (stack->wndprocrecursion)
-      stack->stackpos++;
-
-   stack->SubclassProcs[0].subproc = pfnSubclass;
-   stack->SubclassProcs[0].ref = dwRef;
-   stack->SubclassProcs[0].id = uIDSubclass;
    
+   proc->subproc = pfnSubclass;
+   proc->ref = dwRef;
+   proc->id = uIDSubclass;
+   proc->next = stack->SubclassProcs;
+   stack->SubclassProcs = proc;
+
    return TRUE;
 }
 
@@ -1182,7 +1178,7 @@
                               UINT_PTR uID, DWORD_PTR *pdwRef)
 {
    LPSUBCLASS_INFO stack;
-   int n;
+   LPSUBCLASSPROCS proc;
 
    TRACE ("(%p, %p, %x, %p)\n", hWnd, pfnSubclass, uID, pdwRef);
 
@@ -1191,12 +1187,15 @@
    if (!stack)
       return FALSE;
 
-   for (n = 0; n < stack->stacknum; n++)
-      if ((stack->SubclassProcs[n].id == uID) &&
-         (stack->SubclassProcs[n].subproc == pfnSubclass)) {
-         *pdwRef = stack->SubclassProcs[n].ref;
+   proc = stack->SubclassProcs;
+   while (proc) {
+      if ((proc->id == uID) &&
+         (proc->subproc == pfnSubclass)) {
+         *pdwRef = proc->ref;
          return TRUE;
       }
+      proc = proc->next;
+   }
 
    return FALSE;
 }
@@ -1220,7 +1219,9 @@
 BOOL WINAPI RemoveWindowSubclass(HWND hWnd, SUBCLASSPROC pfnSubclass, UINT_PTR uID)
 {
    LPSUBCLASS_INFO stack;
-   int n;
+   LPSUBCLASSPROCS prevproc = NULL;
+   LPSUBCLASSPROCS proc;
+   BOOL ret = FALSE;
 
    TRACE ("(%p, %p, %x)\n", hWnd, pfnSubclass, uID);
 
@@ -1229,41 +1230,82 @@
    if (!stack)
       return FALSE;
 
-   if ((stack->stacknum == 1) && (stack->stackpos == 1) &&
-       !stack->wndprocrecursion) {
+   proc = stack->SubclassProcs;
+   while (proc) {
+      if ((proc->id == uID) &&
+         (proc->subproc == pfnSubclass)) {
+         
+         if (!prevproc)
+            stack->SubclassProcs = proc->next;
+         else
+            prevproc->next = proc->next;
+          
+         if (stack->stackpos == proc)
+            stack->stackpos = stack->stackpos->next;
+            
+         HeapFree (GetProcessHeap (), 0, proc);
+         ret = TRUE;
+         break;
+      }
+      prevproc = proc;
+      proc = proc->next;
+   }
+   
+   if (!stack->SubclassProcs && !stack->running) {
       TRACE("Last Subclass removed, cleaning up\n");
       /* clean up our heap and reset the origional window procedure */
       if (IsWindowUnicode (hWnd))
-         SetWindowLongW (hWnd, GWL_WNDPROC, (LONG)stack->origproc);
+         SetWindowLongPtrW (hWnd, GWLP_WNDPROC, (DWORD_PTR)stack->origproc);
       else
-         SetWindowLongA (hWnd, GWL_WNDPROC, (LONG)stack->origproc);
+         SetWindowLongPtrA (hWnd, GWLP_WNDPROC, (DWORD_PTR)stack->origproc);
       HeapFree (GetProcessHeap (), 0, stack);
       RemovePropA( hWnd, COMCTL32_aSubclass );
-      return TRUE;
    }
- 
-   for (n = stack->stacknum - 1; n >= 0; n--)
-      if ((stack->SubclassProcs[n].id == uID) &&
-         (stack->SubclassProcs[n].subproc == pfnSubclass)) {
-         if (n != stack->stacknum)
-            /* Fill the hole in the stack */
-            memmove (&stack->SubclassProcs[n], &stack->SubclassProcs[n + 1],
-                    sizeof(stack->SubclassProcs[0]) * (stack->stacknum - n));
-         stack->SubclassProcs[n].subproc = NULL;
-         stack->SubclassProcs[n].ref = 0;
-         stack->SubclassProcs[n].id = 0;
-
-         stack->stacknum--;
-         if (n < stack->stackpos && stack->wndprocrecursion)
-            stack->stackpos--;
+   
+   return ret;
+}
 
-         return TRUE;
-      }
+/***********************************************************************
+ * COMCTL32_SubclassProc (internal)
+ *
+ * Window procedure for all subclassed windows. 
+ * Saves the current subclassing stack position to support nested messages
+ */
+LRESULT WINAPI COMCTL32_SubclassProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+   LPSUBCLASS_INFO stack;
+   LPSUBCLASSPROCS proc;
+   LRESULT ret;
+    
+   TRACE ("(%p, 0x%08x, 0x%08x, 0x%08lx)\n", hWnd, uMsg, wParam, lParam);
 
-   return FALSE;
+   stack = (LPSUBCLASS_INFO)GetPropA (hWnd, COMCTL32_aSubclass);
+   if (!stack) {
+      ERR ("Our sub classing stack got erased for %p!! Nothing we can do\n", hWnd);
+      return 0;
+   }
+    
+   /* Save our old stackpos to properly handle nested messages */
+   proc = stack->stackpos;
+   stack->stackpos = stack->SubclassProcs;
+   stack->running++;
+   ret = DefSubclassProc(hWnd, uMsg, wParam, lParam);
+   stack->running--;
+   stack->stackpos = proc;
+    
+   if (!stack->SubclassProcs) {
+      TRACE("Last Subclass removed, cleaning up\n");
+      /* clean up our heap and reset the origional window procedure */
+      if (IsWindowUnicode (hWnd))
+         SetWindowLongPtrW (hWnd, GWLP_WNDPROC, (DWORD_PTR)stack->origproc);
+      else
+         SetWindowLongPtrA (hWnd, GWLP_WNDPROC, (DWORD_PTR)stack->origproc);
+      HeapFree (GetProcessHeap (), 0, stack);
+      RemovePropA( hWnd, COMCTL32_aSubclass );
+   }
+   return ret;
 }
 
-
 /***********************************************************************
  * DefSubclassProc [COMCTL32.413]
  *
@@ -1284,6 +1326,8 @@
 {
    LPSUBCLASS_INFO stack;
    LRESULT ret;
+   
+   TRACE ("(%p, 0x%08x, 0x%08x, 0x%08lx)\n", hWnd, uMsg, wParam, lParam);
 
    /* retrieve our little stack from the Properties */
    stack = (LPSUBCLASS_INFO)GetPropA (hWnd, COMCTL32_aSubclass);
@@ -1292,41 +1336,19 @@
       return 0;
    }
 
-   stack->wndprocrecursion++;
-
    /* If we are at the end of stack then we have to call the original
     * window procedure */
-   if (stack->stackpos == stack->stacknum) {
+   if (!stack->stackpos) {
       if (IsWindowUnicode (hWnd))
          ret = CallWindowProcW (stack->origproc, hWnd, uMsg, wParam, lParam);
       else
          ret = CallWindowProcA (stack->origproc, hWnd, uMsg, wParam, lParam);
    } else {
-      stack->stackpos++;
+      LPSUBCLASSPROCS proc = stack->stackpos;
+      stack->stackpos = stack->stackpos->next; 
       /* call the Subclass procedure from the stack */
-      ret = stack->SubclassProcs[stack->stackpos - 1].subproc (hWnd, uMsg, wParam, lParam,
-            stack->SubclassProcs[stack->stackpos - 1].id, stack->SubclassProcs[stack->stackpos - 1].ref);
-      stack->stackpos--;
-   }
-
-   /* We finished the recursion, so let's reinitalize the stack position to
-    * beginning */
-   if ((--stack->wndprocrecursion) == 0) {
-      stack->stackpos = 0;
-   }
-
-   /* If we removed the last entry in our stack while a window procedure was
-    * running then we have to clean up */
-   if ((stack->stackpos == 0) && (stack->stacknum == 0)) {
-      TRACE("Last Subclass removed, cleaning up\n");
-      /* clean up our heap and reset the origional window procedure */
-      if (IsWindowUnicode (hWnd))
-         SetWindowLongW (hWnd, GWL_WNDPROC, (LONG)stack->origproc);
-      else
-         SetWindowLongA (hWnd, GWL_WNDPROC, (LONG)stack->origproc);
-      HeapFree (GetProcessHeap (), 0, stack);
-      RemovePropA( hWnd, COMCTL32_aSubclass );
-      return TRUE;
+      ret = proc->subproc (hWnd, uMsg, wParam, lParam,
+            proc->id, proc->ref);
    }
 
    return ret;
@@ -1364,12 +1386,12 @@
         /* 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.idFrom = GetWindowLongPtrW(hwndTrueOwner, GWLP_ID);
 	nmttc.hdr.code = NM_TOOLTIPSCREATED;
 	nmttc.hwndToolTips = hwndToolTip;
 
        SendMessageA(GetParent(hwndTrueOwner), WM_NOTIFY,
-                    (WPARAM)GetWindowLongA(hwndTrueOwner, GWL_ID),
+                    (WPARAM)GetWindowLongPtrW(hwndTrueOwner, GWLP_ID),
 		     (LPARAM)&nmttc);
     }
 
@@ -1410,3 +1432,56 @@
     comctl32_color.clrInfoBk = GetSysColor (COLOR_INFOBK);
     comctl32_color.clrInfoText = GetSysColor (COLOR_INFOTEXT);
 }
+
+/***********************************************************************
+ * COMCTL32_DrawInsertMark [NOT AN API]
+ *
+ * Draws an insertion mark (which looks similar to an 'I').
+ *
+ * PARAMS
+ *     hDC           [I] Device context to draw onto.
+ *     lpRect        [I] Co-ordinates of insertion mark.
+ *     clrInsertMark [I] Colour of the insertion mark.
+ *     bHorizontal   [I] True if insert mark should be drawn horizontally,
+ *                       vertical otherwise.
+ *
+ * RETURNS
+ *     none
+ *
+ * NOTES
+ *     Draws up to but not including the bottom co-ordinate when drawing
+ *     vertically or the right co-ordinate when horizontal.
+ */
+void COMCTL32_DrawInsertMark(HDC hDC, const RECT *lpRect, COLORREF clrInsertMark, BOOL bHorizontal)
+{
+    HPEN hPen = CreatePen(PS_SOLID, 1, clrInsertMark);
+    HPEN hOldPen;
+    static const DWORD adwPolyPoints[] = {4,4,4};
+    LONG lCentre = (bHorizontal ? 
+        lpRect->top + (lpRect->bottom - lpRect->top)/2 : 
+        lpRect->left + (lpRect->right - lpRect->left)/2);
+    LONG l1 = (bHorizontal ? lpRect->left : lpRect->top);
+    LONG l2 = (bHorizontal ? lpRect->right : lpRect->bottom);
+    const POINT aptInsertMark[] =
+    {
+        /* top (V) or left (H) arrow */
+        {lCentre    , l1 + 2},
+        {lCentre - 2, l1    },
+        {lCentre + 3, l1    },
+        {lCentre + 1, l1 + 2},
+        /* middle line */
+        {lCentre    , l2 - 2},
+        {lCentre    , l1 - 1},
+        {lCentre + 1, l1 - 1},
+        {lCentre + 1, l2 - 2},
+        /* bottom (V) or right (H) arrow */
+        {lCentre    , l2 - 3},
+        {lCentre - 2, l2 - 1},
+        {lCentre + 3, l2 - 1},
+        {lCentre + 1, l2 - 3},
+    };
+    hOldPen = SelectObject(hDC, hPen);
+    PolyPolyline(hDC, aptInsertMark, adwPolyPoints, sizeof(adwPolyPoints)/sizeof(adwPolyPoints[0]));
+    SelectObject(hDC, hOldPen);
+    DeleteObject(hPen);
+}

reactos/lib/comctl32
datetime.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- datetime.c	8 May 2004 11:41:04 -0000	1.4
+++ datetime.c	19 Sep 2004 09:50:06 -0000	1.5
@@ -110,7 +110,7 @@
 #define DTHT_MCPOPUP  0x300     /* & DTHT_DATEFIELD 0 when DATETIME_KeyDown */
 #define DTHT_GOTFOCUS 0x400     /* tests for date-fields */
 
-#define DATETIME_GetInfoPtr(hwnd) ((DATETIME_INFO *)GetWindowLongA (hwnd, 0))
+#define DATETIME_GetInfoPtr(hwnd) ((DATETIME_INFO *)GetWindowLongPtrW (hwnd, 0))
 
 static BOOL DATETIME_SendSimpleNotify (HWND hwnd, UINT code);
 static BOOL DATETIME_SendDateTimeChangeNotify (HWND hwnd);
@@ -256,7 +256,8 @@
 static void
 DATETIME_UseFormat (DATETIME_INFO *infoPtr, const char *formattxt)
 {
- int i,j,k,len;
+ unsigned int i;
+ int j,k,len;
  int *nrFields=& infoPtr->nrFields;
 
  TRACE ("%s\n",formattxt);
@@ -267,7 +268,7 @@
  len=strlen(allowedformatchars);
  k=0;
 
- for (i=0; i<strlen (formattxt); i++)  {
+ for (i=0; formattxt[i]; i++)  {
 	TRACE ("\n%d %c:",i, formattxt[i]);
  	for (j=0; j<len; j++) {
  		if (allowedformatchars[j]==formattxt[i]) {
@@ -1128,7 +1129,7 @@
 
  TRACE ("\n");
  dtdtc.nmhdr.hwndFrom = hwnd;
- dtdtc.nmhdr.idFrom   = GetWindowLongA( hwnd, GWL_ID);
+ dtdtc.nmhdr.idFrom   = GetWindowLongPtrW(hwnd, GWLP_ID);
  dtdtc.nmhdr.code     = DTN_DATETIMECHANGE;
 
  if ((GetWindowLongA (hwnd, GWL_STYLE) & DTS_SHOWNONE))
@@ -1150,7 +1151,7 @@
 
     TRACE("%x\n",code);
     nmhdr.hwndFrom = hwnd;
-    nmhdr.idFrom   = GetWindowLongA( hwnd, GWL_ID);
+    nmhdr.idFrom   = GetWindowLongPtrW(hwnd, GWLP_ID);
     nmhdr.code     = code;
 
     return (BOOL) SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,
@@ -1221,14 +1222,14 @@
     return 0;
   }
 
-  SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
+  SetWindowLongPtrA (hwnd, 0, (DWORD_PTR)infoPtr);
 
   if (dwStyle & DTS_SHOWNONE) {
     infoPtr->hwndCheckbut=CreateWindowExA (0,"button", 0,
          WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,
          2,2,13,13,
          hwnd,
-         0, (HINSTANCE)GetWindowLongA  (hwnd, GWL_HINSTANCE), 0);
+         0, (HINSTANCE)GetWindowLongPtrW (hwnd, GWLP_HINSTANCE), 0);
          SendMessageA (infoPtr->hwndCheckbut, BM_SETCHECK, 1, 0);
   }
 
@@ -1276,7 +1277,7 @@
 	infoPtr->hMonthCal = NULL;
     }
     Free (infoPtr);
-    SetWindowLongA( hwnd, 0, 0 ); /* clear infoPtr */
+    SetWindowLongPtrA( hwnd, 0, 0 ); /* clear infoPtr */
     return 0;
 }
 

reactos/lib/comctl32
draglist.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- draglist.c	15 Apr 2004 08:29:56 -0000	1.4
+++ draglist.c	19 Sep 2004 09:50:06 -0000	1.5
@@ -74,7 +74,7 @@
     RECT last_drag_icon_rect;
 } DRAGLISTDATA;
 
-static UINT uDragListMessage = 0; /* registered window message code */
+UINT uDragListMessage = 0; /* registered window message code */
 static DWORD dwLastScrollTime = 0;
 static HICON hDragArrow = NULL;
 
@@ -99,9 +99,10 @@
 {
     KillTimer(hwnd, DRAGLIST_TIMERID);
     ReleaseCapture();
-    data->dragging = FALSE;
     /* clear any drag insert icon present */
     InvalidateRect(GetParent(hwnd), &data->last_drag_icon_rect, TRUE);
+    /* clear data for next use */
+    memset(data, 0, sizeof(*data));
 }
 
 /***********************************************************************
@@ -118,8 +119,6 @@
     {
     case WM_LBUTTONDOWN:
         SetFocus(hwnd);
-        data->cursor = NULL;
-        SetRectEmpty(&data->last_drag_icon_rect);
         data->dragging = DragList_Notify(hwnd, DL_BEGINDRAG);
         if (data->dragging)
         {
@@ -183,15 +182,6 @@
         }
         break;
 
-	case WM_SETCURSOR:
-	    /* if app has told us to set a cursor then do so */
-        if (data->dragging && data->cursor)
-        {
-            SetCursor(data->cursor);
-            return TRUE;
-        }
-        break;
-
     case WM_GETDLGCODE:
         /* tell dialog boxes that we want to receive WM_KEYDOWN events
          * for keys like VK_ESCAPE */

reactos/lib/comctl32
flatsb.c 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- flatsb.c	11 Mar 2004 11:13:28 -0000	1.6
+++ flatsb.c	19 Sep 2004 09:50:06 -0000	1.7
@@ -47,7 +47,7 @@
     DWORD dwDummy;  /* just to keep the compiler happy ;-) */
 } FLATSB_INFO, *LPFLATSB_INFO;
 
-#define FlatSB_GetInfoPtr(hwnd) ((FLATSB_INFO*)GetWindowLongA (hwnd, 0))
+#define FlatSB_GetInfoPtr(hwnd) ((FLATSB_INFO*)GetWindowLongPtrW (hwnd, 0))
 
 
 /***********************************************************************

reactos/lib/comctl32
header.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- header.c	8 May 2004 11:41:04 -0000	1.5
+++ header.c	19 Sep 2004 09:50:06 -0000	1.6
@@ -92,7 +92,7 @@
 #define VERT_BORDER     3
 #define DIVIDER_WIDTH  10
 
-#define HEADER_GetInfoPtr(hwnd) ((HEADER_INFO *)GetWindowLongA(hwnd,0))
+#define HEADER_GetInfoPtr(hwnd) ((HEADER_INFO *)GetWindowLongPtrW(hwnd,0))
 
 
 inline static LRESULT
@@ -108,8 +108,8 @@
 HEADER_OrderToIndex(HWND hwnd, WPARAM wParam)
 {
     HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
-    INT i,iorder = (INT)wParam;
-
+    INT iorder = (INT)wParam;
+    UINT i;
 
     if ((iorder <0) || iorder >infoPtr->uNumItem)
       return iorder;
@@ -125,7 +125,8 @@
     HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
     HEADER_ITEM *phdi;
     RECT rect;
-    int i, x;
+    unsigned int i;
+    int x;
 
     infoPtr->bRectsValid = TRUE;
 
@@ -190,7 +191,7 @@
     if (phdi->fmt & HDF_OWNERDRAW) {
 	DRAWITEMSTRUCT dis;
 	dis.CtlType    = ODT_HEADER;
-	dis.CtlID      = GetWindowLongA (hwnd, GWL_ID);
+	dis.CtlID      = GetWindowLongPtrW (hwnd, GWLP_ID);
 	dis.itemID     = iItem;
 	dis.itemAction = ODA_DRAWENTIRE;
 	dis.itemState  = phdi->bDown ? ODS_SELECTED : 0;
@@ -354,7 +355,8 @@
     HFONT hFont, hOldFont;
     RECT rect;
     HBRUSH hbrBk;
-    INT i, x;
+    UINT i;
+    INT x;
 
     /* get rect for the bar, adjusted for the border */
     GetClientRect (hwnd, &rect);
@@ -401,7 +403,8 @@
 {
     HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
     RECT rect, rcTest;
-    INT  iCount, width;
+    UINT iCount;
+    INT width;
     BOOL bNoWidth;
 
     GetClientRect (hwnd, &rect);
@@ -542,7 +545,7 @@
     NMHDR nmhdr;
 
     nmhdr.hwndFrom = hwnd;
-    nmhdr.idFrom   = GetWindowLongA (hwnd, GWL_ID);
+    nmhdr.idFrom   = GetWindowLongPtrW (hwnd, GWLP_ID);
     nmhdr.code     = code;
 
     return (BOOL)SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,
@@ -557,7 +560,7 @@
     HDITEMA nmitem;
 
     nmhdr.hdr.hwndFrom = hwnd;
-    nmhdr.hdr.idFrom   = GetWindowLongA (hwnd, GWL_ID);
+    nmhdr.hdr.idFrom   = GetWindowLongPtrW (hwnd, GWLP_ID);
     nmhdr.hdr.code = code;
     nmhdr.iItem = iItem;
     nmhdr.iButton = 0;
@@ -586,7 +589,7 @@
     NMHEADERA nmhdr;
 
     nmhdr.hdr.hwndFrom = hwnd;
-    nmhdr.hdr.idFrom   = GetWindowLongA (hwnd, GWL_ID);
+    nmhdr.hdr.idFrom   = GetWindowLongPtrW (hwnd, GWLP_ID);
     nmhdr.hdr.code = code;
     nmhdr.iItem = iItem;
     nmhdr.iButton = 0;
@@ -814,7 +817,7 @@
     LPINT order = (LPINT) lParam;
     HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
 
-    if ((int)wParam <infoPtr->uNumItem)
+    if ((unsigned int)wParam <infoPtr->uNumItem)
       return FALSE;
     for (i=0; i<(int)wParam; i++)
       *order++=HEADER_OrderToIndex(hwnd,i);
@@ -829,7 +832,7 @@
     HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
     HEADER_ITEM *lpItem;
 
-    if ((int)wParam <infoPtr->uNumItem)
+    if ((unsigned int)wParam <infoPtr->uNumItem)
       return FALSE;
     for (i=0; i<(int)wParam; i++)
       {
@@ -856,10 +859,10 @@
 
     HEADER_InternalHitTest (hwnd, &phti->pt, &phti->flags, &phti->iItem);
 
-    if (phti->flags == HHT_ONHEADER)
-        return phti->iItem;
-    else
+    if (phti->flags == HHT_NOWHERE)
         return -1;
+    else
+        return phti->iItem;
 }
 
 
@@ -870,7 +873,8 @@
     HDITEMA   *phdi = (HDITEMA*)lParam;
     INT       nItem = (INT)wParam;
     HEADER_ITEM *lpItem;
-    INT       len, i, iOrder;
+    INT       len, iOrder;
+    UINT      i;
 
     if ((phdi == NULL) || (nItem < 0))
 	return -1;
@@ -971,7 +975,8 @@
     HDITEMW   *phdi = (HDITEMW*)lParam;
     INT       nItem = (INT)wParam;
     HEADER_ITEM *lpItem;
-    INT       len, i, iOrder;
+    INT       len, iOrder;
+    UINT      i;
 
     if ((phdi == NULL) || (nItem < 0))
 	return -1;
@@ -1284,7 +1289,7 @@
     HDC   hdc;
 
     infoPtr = (HEADER_INFO *)Alloc (sizeof(HEADER_INFO));
-    SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
+    SetWindowLongPtrA (hwnd, 0, (DWORD_PTR)infoPtr);
 
     infoPtr->hwndNotify = ((LPCREATESTRUCTA)lParam)->hwndParent;
     infoPtr->uNumItem = 0;
@@ -1335,7 +1340,7 @@
 	ImageList_Destroy (infoPtr->himl);
 
     Free (infoPtr);
-    SetWindowLongA (hwnd, 0, 0);
+    SetWindowLongPtrA (hwnd, 0, 0);
     return 0;
 }
 
@@ -1496,9 +1501,9 @@
 		infoPtr->items[infoPtr->iMoveItem].cxy = nWidth;
             }
 
-			HEADER_SendHeaderNotify(hwnd, HDN_ITEMCHANGINGA, infoPtr->iMoveItem, HDI_WIDTH);
 	    HEADER_SetItemBounds (hwnd);
-	    InvalidateRect(hwnd, NULL, FALSE);
+	    InvalidateRect(hwnd, NULL, TRUE);
+	    HEADER_SendHeaderNotify(hwnd, HDN_ITEMCHANGEDA, infoPtr->iMoveItem, HDI_WIDTH);
        /*
 	* }
         */
@@ -1571,7 +1576,7 @@
 	}
 	else if (infoPtr->bTracking) {
 	    if (dwStyle & HDS_FULLDRAG) {
-		if (HEADER_SendHeaderNotify (hwnd, HDN_ITEMCHANGINGA, infoPtr->iMoveItem, HDI_WIDTH))
+		if (HEADER_SendHeaderNotify (hwnd, HDN_TRACKA, infoPtr->iMoveItem, HDI_WIDTH))
 		{
 		nWidth = pt.x - infoPtr->items[infoPtr->iMoveItem].rect.left + infoPtr->xTrackOffset;
 		if (nWidth < 0)
@@ -1580,7 +1585,6 @@
 			HEADER_SendHeaderNotify(hwnd, HDN_ITEMCHANGEDA, infoPtr->iMoveItem, HDI_WIDTH);
 		}
 		HEADER_SetItemBounds (hwnd);
-		InvalidateRect(hwnd, NULL, FALSE);
 	    }
 	    else {
 		hdc = GetDC (hwnd);

reactos/lib/comctl32
hotkey.c 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- hotkey.c	17 Dec 2003 18:09:54 -0000	1.3
+++ hotkey.c	19 Sep 2004 09:50:06 -0000	1.4
@@ -51,7 +51,7 @@
     WCHAR strNone[15]; /* hope its long enough ... */
 } HOTKEY_INFO;
 
-#define HOTKEY_GetInfoPtr(hwnd) ((HOTKEY_INFO *)GetWindowLongA (hwnd, 0))
+#define HOTKEY_GetInfoPtr(hwnd) ((HOTKEY_INFO *)GetWindowLongPtrA (hwnd, 0))
 
 static const WCHAR HOTKEY_plussep[] = { ' ', '+', ' ' };
 
@@ -217,7 +217,7 @@
 
     /* allocate memory for info structure */
     infoPtr = (HOTKEY_INFO *)Alloc (sizeof(HOTKEY_INFO));
-    SetWindowLongW (hwnd, 0, (DWORD)infoPtr);
+    SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
 
     /* initialize info structure */
     infoPtr->HotKey = infoPtr->InvComb = infoPtr->InvMod = infoPtr->CurrMod = 0;
@@ -242,7 +242,7 @@
     HWND hwnd = infoPtr->hwndSelf;
     /* free hotkey info data */
     Free (infoPtr);
-    SetWindowLongW (hwnd, 0, 0);
+    SetWindowLongPtrW (hwnd, 0, 0);
     return 0;
 }
 

reactos/lib/comctl32
imagelist.c 1.13 -> 1.14
diff -u -r1.13 -r1.14
--- imagelist.c	14 Aug 2004 19:12:35 -0000	1.13
+++ imagelist.c	19 Sep 2004 09:50:06 -0000	1.14
@@ -3,7 +3,7 @@
  *
  *  Copyright 1998 Eric Kohl
  *  Copyright 2000 Jason Mawdsley
- *  Copyright 2001 Michael Stefaniuc
+ *  Copyright 2001, 2004 Michael Stefaniuc
  *  Copyright 2001 Charles Loep for CodeWeavers
  *  Copyright 2002 Dimitrie O. Paun
  *
@@ -34,12 +34,6 @@
  *    - Add support for ILD_PRESERVEALPHA, ILD_SCALE, ILD_DPISCALE
  *    - Add support for ILS_GLOW, ILS_SHADOW, ILS_SATURATE, ILS_ALPHA
  *    - Thread-safe locking
- *
- *  FIXME:
- *    - Hotspot handling still not correct. The Hotspot passed to BeginDrag
- *	is the offset of the image position relative to the actual mouse pointer
- *	position. However the Hotspot passed to SetDragCursorImage is the
- *	offset of the mouse messages sent to the application...
  */
 
 #include <stdarg.h>
@@ -76,10 +70,9 @@
     BOOL	bShow;
     /* saved background */
     HBITMAP	hbmBg;
-    BOOL	bHSPending;
 } INTERNALDRAG;
 
-static INTERNALDRAG InternalDrag = { 0, 0, 0, 0, 0, 0, FALSE, 0, FALSE };
+static INTERNALDRAG InternalDrag = { 0, 0, 0, 0, 0, 0, FALSE, 0 };
 
 static HBITMAP ImageList_CreateImage(HDC hdc, HIMAGELIST himl, UINT width, UINT height);
 
@@ -424,7 +417,6 @@
     BitBlt (InternalDrag.himl->hdcMask, 0, 0, cx, cy, himlTrack->hdcMask, iTrack * cx, 0, SRCCOPY);
 
     InternalDrag.himl->cCurImage = 1;
-    InternalDrag.bHSPending = TRUE;
 
     return TRUE;
 }
@@ -1279,7 +1271,6 @@
     InternalDrag.bShow = FALSE;
     DeleteObject(InternalDrag.hbmBg);
     InternalDrag.hbmBg = 0;
-    InternalDrag.bHSPending = FALSE;
 }
 
 
@@ -2362,7 +2353,11 @@
  *     Failure: FALSE
  *
  * NOTES
- *     When this function is called and the drag image is visible, a
+ *   - The names dxHotspot, dyHotspot are misleading because they have nothing
+ *     to do with a hotspot but are only the offset of the origin of the new
+ *     image relative to the origin of the old image.
+ *
+ *   - When this function is called and the drag image is visible, a
  *     short flickering occurs but this matches the Win9x behavior. It is
  *     possible to fix the flickering using code like in ImageList_DragMove.
  */
@@ -2372,7 +2367,6 @@
 			      INT dxHotspot, INT dyHotspot)
 {
     HIMAGELIST himlTemp;
-    INT dx, dy;
     BOOL visible;
 
     if (!is_valid(InternalDrag.himl) || !is_valid(himlDrag))
@@ -2383,20 +2377,8 @@
 
     visible = InternalDrag.bShow;
 
-    /* Calculate the offset between the origin of the old image and the
-     * origin of the second image.
-     * dxHotspot, dyHotspot is the offset of THE Hotspot (there is only one
-     * hotspot) to the origin of the second image.
-     * See M$DN for details */
-    if(InternalDrag.bHSPending) {
-	dx = 0;
-	dy = 0;
-	InternalDrag.bHSPending = FALSE;
-    } else {
-	dx = InternalDrag.dxHotspot - dxHotspot;
-	dy = InternalDrag.dyHotspot - dyHotspot;
-    }
-    himlTemp = ImageList_Merge (InternalDrag.himl, 0, himlDrag, iDrag, dx, dy);
+    himlTemp = ImageList_Merge (InternalDrag.himl, 0, himlDrag, iDrag,
+                                dxHotspot, dyHotspot);
 
     if (visible) {
 	/* hide the drag image */
@@ -2412,13 +2394,6 @@
     ImageList_Destroy (InternalDrag.himl);
     InternalDrag.himl = himlTemp;
 
-    /* update the InternalDragOffset, if the origin of the
-     * DragImage was changed by ImageList_Merge. */
-    if (dx <= 0)
-	InternalDrag.dxHotspot = dxHotspot;
-    if (dy <= 0)
-	InternalDrag.dyHotspot = dyHotspot;
-
     if (visible) {
 	/* show the drag image */
 	ImageList_DragShowNolock(TRUE);

reactos/lib/comctl32
ipaddress.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- ipaddress.c	8 May 2004 11:41:04 -0000	1.5
+++ ipaddress.c	19 Sep 2004 09:50:06 -0000	1.6
@@ -71,7 +71,7 @@
 #define POS_SELALL	3
 
 #define IP_SUBCLASS_PROP "CCIP32SubclassInfo"
-#define IPADDRESS_GetInfoPtr(hwnd) ((IPADDRESS_INFO *)GetWindowLongW (hwnd, 0))
+#define IPADDRESS_GetInfoPtr(hwnd) ((IPADDRESS_INFO *)GetWindowLongPtrW (hwnd, 0))
 
 
 static LRESULT CALLBACK
@@ -84,7 +84,7 @@
     TRACE("(command=%x)\n", command);
 
     return SendMessageW (infoPtr->Notify, WM_COMMAND,
-             MAKEWPARAM (GetWindowLongW (hwnd, GWL_ID), command), (LPARAM)hwnd);
+             MAKEWPARAM (GetWindowLongPtrW (hwnd, GWLP_ID), command), (LPARAM)hwnd);
 }
 
 static INT IPADDRESS_IPNotify (IPADDRESS_INFO *infoPtr, INT field, INT value)
@@ -94,7 +94,7 @@
     TRACE("(field=%x, value=%d)\n", field, value);
 
     nmip.hdr.hwndFrom = infoPtr->Self;
-    nmip.hdr.idFrom   = GetWindowLongW (infoPtr->Self, GWL_ID);
+    nmip.hdr.idFrom   = GetWindowLongPtrW (infoPtr->Self, GWLP_ID);
     nmip.hdr.code     = IPN_FIELDCHANGED;
 
     nmip.iField = field;
@@ -164,7 +164,7 @@
 
     infoPtr = (IPADDRESS_INFO *)Alloc (sizeof(IPADDRESS_INFO));
     if (!infoPtr) return -1;
-    SetWindowLongW (hwnd, 0, (DWORD)infoPtr);
+    SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
 
     GetClientRect (hwnd, &rcClient);
 
@@ -187,11 +187,11 @@
 		CreateWindowW (EDIT, NULL, WS_CHILD | WS_VISIBLE | ES_CENTER,
                                edit.left, edit.top, edit.right - edit.left,
 			       edit.bottom - edit.top, hwnd, (HMENU) 1,
-			       (HINSTANCE)GetWindowLongW(hwnd, GWL_HINSTANCE), NULL);
+			       (HINSTANCE)GetWindowLongPtrW(hwnd, GWLP_HINSTANCE), NULL);
 	SetPropA(part->EditHwnd, IP_SUBCLASS_PROP, hwnd);
         part->OrigProc = (WNDPROC)
-		SetWindowLongW (part->EditHwnd, GWL_WNDPROC,
-				(LONG)IPADDRESS_SubclassProc);
+		SetWindowLongPtrW (part->EditHwnd, GWLP_WNDPROC,
+				(DWORD_PTR)IPADDRESS_SubclassProc);
     }
 
     return 0;
@@ -206,10 +206,10 @@
 
     for (i = 0; i < 4; i++) {
 	IPPART_INFO* part = &infoPtr->Part[i];
-        SetWindowLongW (part->EditHwnd, GWL_WNDPROC, (LONG)part->OrigProc);
+        SetWindowLongPtrW (part->EditHwnd, GWLP_WNDPROC, (DWORD_PTR)part->OrigProc);
     }
 
-    SetWindowLongW (infoPtr->Self, 0, 0);
+    SetWindowLongPtrW (infoPtr->Self, 0, 0);
     Free (infoPtr);
     return 0;
 }
@@ -565,12 +565,12 @@
     WNDCLASSW wndClass;
 
     ZeroMemory (&wndClass, sizeof(WNDCLASSW));
-    wndClass.style         = CS_GLOBALCLASS;
-    wndClass.lpfnWndProc   = (WNDPROC)IPADDRESS_WindowProc;
+    wndClass.style         = CS_GLOBALCLASS | CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;
+    wndClass.lpfnWndProc   = IPADDRESS_WindowProc;
     wndClass.cbClsExtra    = 0;
     wndClass.cbWndExtra    = sizeof(IPADDRESS_INFO *);
     wndClass.hCursor       = LoadCursorW (0, (LPWSTR)IDC_IBEAM);
-    wndClass.hbrBackground = GetStockObject(WHITE_BRUSH);
+    wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
     wndClass.lpszClassName = WC_IPADDRESSW;
 
     RegisterClassW (&wndClass);

reactos/lib/comctl32
listview.c 1.14 -> 1.15
diff -u -r1.14 -r1.15
--- listview.c	14 Aug 2004 19:12:35 -0000	1.14
+++ listview.c	19 Sep 2004 09:50:06 -0000	1.15
@@ -41,7 +41,7 @@
  * Bugs
  *   -- Expand large item in ICON mode when the cursor is flying over the icon or text.
  *   -- Support CustonDraw options for _WIN32_IE >= 0x560 (see NMLVCUSTOMDRAW docs.
- *   -- in LISTVIEW_AddGroupSelection, se whould send LVN_ODSTATECHANGED 
+ *   -- in LISTVIEW_AddGroupSelection, we would send LVN_ODSTATECHANGED 
  *   -- LVA_SNAPTOGRID not implemented
  *   -- LISTVIEW_ApproximateViewRect partially implemented
  *   -- LISTVIEW_[GS]etColumnOrderArray stubs
@@ -717,7 +717,7 @@
     TRACE("(code=%d)\n", code);
 
     pnmh->hwndFrom = infoPtr->hwndSelf;
-    pnmh->idFrom = GetWindowLongW(infoPtr->hwndSelf, GWL_ID);
+    pnmh->idFrom = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID);
     pnmh->code = code;
     result = SendMessageW(infoPtr->hwndNotify, WM_NOTIFY,
 			  (WPARAM)pnmh->idFrom, (LPARAM)pnmh);
@@ -1732,7 +1732,7 @@
 	   
 	ZeroMemory(&dis, sizeof(dis)); 
 	dis.CtlType = ODT_LISTVIEW;
-	dis.CtlID = GetWindowLongW(infoPtr->hwndSelf, GWL_ID);
+	dis.CtlID = (UINT)GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID);
 	dis.itemID = item.iItem;
 	dis.itemAction = ODA_FOCUS;
 	if (fShow) dis.itemState |= ODS_FOCUS;
@@ -3691,7 +3691,7 @@
  */
 static void LISTVIEW_RefreshOwnerDraw(LISTVIEW_INFO *infoPtr, ITERATOR *i, HDC hdc, DWORD cdmode)
 {
-    UINT uID = GetWindowLongW(infoPtr->hwndSelf, GWL_ID);
+    UINT uID = (UINT)GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID);
     DWORD cditemmode = CDRF_DODEFAULT;
     NMLVCUSTOMDRAW nmlvcd;
     POINT Origin, Position;
@@ -7380,7 +7380,7 @@
   infoPtr = (LISTVIEW_INFO *)Alloc(sizeof(LISTVIEW_INFO));
   if (!infoPtr) return -1;
 
-  SetWindowLongW(hwnd, 0, (LONG)infoPtr);
+  SetWindowLongPtrW(hwnd, 0, (DWORD_PTR)infoPtr);
 
   infoPtr->hwndSelf = hwnd;
   infoPtr->dwStyle = lpcs->style;
@@ -7725,7 +7725,7 @@
 {
     UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     INT gcWheelDelta = 0;
-    UINT pulScrollLines = 3;
+    INT pulScrollLines = 3;
     SCROLLINFO scrollInfo;
 
     TRACE("(wheelDelta=%d)\n", wheelDelta);
@@ -8182,7 +8182,7 @@
   if (infoPtr->hDefaultFont) DeleteObject(infoPtr->hDefaultFont);
   if (infoPtr->clrBk != CLR_NONE) DeleteObject(infoPtr->hBkBrush);
 
-  SetWindowLongW(infoPtr->hwndSelf, 0, 0);
+  SetWindowLongPtrW(infoPtr->hwndSelf, 0, 0);
 
   /* free listview info pointer*/
   Free(infoPtr);
@@ -8774,7 +8774,7 @@
 static LRESULT WINAPI
 LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
-  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0);
+  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongPtrW(hwnd, 0);
 
   TRACE("(uMsg=%x wParam=%x lParam=%lx)\n", uMsg, wParam, lParam);
 
@@ -9382,7 +9382,7 @@
  */
 static LRESULT EditLblWndProcT(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL isW)
 {
-    LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(GetParent(hwnd), 0);
+    LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongPtrW(GetParent(hwnd), 0);
     BOOL cancel = FALSE;
 
     TRACE("(hwnd=%p, uMsg=%x, wParam=%x, lParam=%lx, isW=%d)\n",
@@ -9400,7 +9400,7 @@
 	{
 	    WNDPROC editProc = infoPtr->EditWndProc;
 	    infoPtr->EditWndProc = 0;
-	    SetWindowLongW(hwnd, GWL_WNDPROC, (LONG)editProc);
+	    SetWindowLongPtrW(hwnd, GWLP_WNDPROC, (DWORD_PTR)editProc);
 	    return CallWindowProcT(editProc, hwnd, uMsg, wParam, lParam, isW);
 	}
 
@@ -9501,7 +9501,7 @@
     HDC hdc;
     HDC hOldFont=0;
     TEXTMETRICW textMetric;
-    HINSTANCE hinst = (HINSTANCE)GetWindowLongW(infoPtr->hwndSelf, GWL_HINSTANCE);
+    HINSTANCE hinst = (HINSTANCE)GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_HINSTANCE);
 
     TRACE("(text=%s, ..., isW=%d)\n", debugtext_t(text, isW), isW);
 
@@ -9532,8 +9532,8 @@
     if (!hedit) return 0;
 
     infoPtr->EditWndProc = (WNDPROC)
-	(isW ? SetWindowLongW(hedit, GWL_WNDPROC, (LONG)EditLblWndProcW) :
-               SetWindowLongA(hedit, GWL_WNDPROC, (LONG)EditLblWndProcA) );
+	(isW ? SetWindowLongPtrW(hedit, GWLP_WNDPROC, (DWORD_PTR)EditLblWndProcW) :
+               SetWindowLongPtrA(hedit, GWLP_WNDPROC, (DWORD_PTR)EditLblWndProcA) );
 
     SendMessageW(hedit, WM_SETFONT, (WPARAM)infoPtr->hFont, FALSE);
 

reactos/lib/comctl32
monthcal.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- monthcal.c	8 May 2004 11:41:04 -0000	1.4
+++ monthcal.c	19 Sep 2004 09:50:06 -0000	1.5
@@ -114,7 +114,7 @@
 static const int DayOfWeekTable[] = {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4};
 
 
-#define MONTHCAL_GetInfoPtr(hwnd) ((MONTHCAL_INFO *)GetWindowLongA(hwnd, 0))
+#define MONTHCAL_GetInfoPtr(hwnd) ((MONTHCAL_INFO *)GetWindowLongPtrW(hwnd, 0))
 
 /* helper functions  */
 
@@ -1302,7 +1302,7 @@
     int i;
 
     nmds.nmhdr.hwndFrom = hwnd;
-    nmds.nmhdr.idFrom   = GetWindowLongA(hwnd, GWL_ID);
+    nmds.nmhdr.idFrom   = GetWindowLongPtrW(hwnd, GWLP_ID);
     nmds.nmhdr.code     = MCN_GETDAYSTATE;
     nmds.cDayState	= infoPtr->monthRange;
     nmds.prgDayState	= Alloc(infoPtr->monthRange * sizeof(MONTHDAYSTATE));
@@ -1332,7 +1332,7 @@
     int i;
 
     nmds.nmhdr.hwndFrom = hwnd;
-    nmds.nmhdr.idFrom   = GetWindowLongA(hwnd, GWL_ID);
+    nmds.nmhdr.idFrom   = GetWindowLongPtrW(hwnd, GWLP_ID);
     nmds.nmhdr.code     = MCN_GETDAYSTATE;
     nmds.cDayState	= infoPtr->monthRange;
     nmds.prgDayState	= Alloc
@@ -1491,7 +1491,7 @@
     MONTHCAL_SetCurSel(hwnd,0,(LPARAM) &selArray);
     TRACE("MCHT_CALENDARDATE\n");
     nmsc.nmhdr.hwndFrom = hwnd;
-    nmsc.nmhdr.idFrom   = GetWindowLongA(hwnd, GWL_ID);
+    nmsc.nmhdr.idFrom   = GetWindowLongPtrW(hwnd, GWLP_ID);
     nmsc.nmhdr.code     = MCN_SELCHANGE;
     MONTHCAL_CopyTime(&infoPtr->minSel,&nmsc.stSelStart);
     MONTHCAL_CopyTime(&infoPtr->maxSel,&nmsc.stSelEnd);
@@ -1559,7 +1559,7 @@
     return TRUE;
   }
   nmhdr.hwndFrom = hwnd;
-  nmhdr.idFrom   = GetWindowLongA( hwnd, GWL_ID);
+  nmhdr.idFrom   = GetWindowLongPtrW( hwnd, GWLP_ID);
   nmhdr.code     = NM_RELEASEDCAPTURE;
   TRACE("Sent notification from %p to %p\n", hwnd, infoPtr->hwndNotify);
 
@@ -1571,7 +1571,7 @@
   /* only send MCN_SELECT if currently displayed month's day was selected */
   if(hit == MCHT_CALENDARDATE) {
     nmsc.nmhdr.hwndFrom = hwnd;
-    nmsc.nmhdr.idFrom   = GetWindowLongA(hwnd, GWL_ID);
+    nmsc.nmhdr.idFrom   = GetWindowLongPtrW(hwnd, GWLP_ID);
     nmsc.nmhdr.code     = MCN_SELECT;
     MONTHCAL_CopyTime(&infoPtr->minSel, &nmsc.stSelStart);
     MONTHCAL_CopyTime(&infoPtr->maxSel, &nmsc.stSelEnd);
@@ -1877,13 +1877,13 @@
 
   /* allocate memory for info structure */
   infoPtr =(MONTHCAL_INFO*)Alloc(sizeof(MONTHCAL_INFO));
-  SetWindowLongA(hwnd, 0, (DWORD)infoPtr);
+  SetWindowLongPtrW(hwnd, 0, (DWORD_PTR)infoPtr);
 
   if(infoPtr == NULL) {
     ERR( "could not allocate info memory!\n");
     return 0;
   }
-  if((MONTHCAL_INFO*)GetWindowLongA(hwnd, 0) != infoPtr) {
+  if((MONTHCAL_INFO*)GetWindowLongPtrW(hwnd, 0) != infoPtr) {
     ERR( "pointer assignment error!\n");
     return 0;
   }
@@ -1934,7 +1934,7 @@
   if(infoPtr->monthdayState)
       Free(infoPtr->monthdayState);
   Free(infoPtr);
-  SetWindowLongA(hwnd, 0, 0);
+  SetWindowLongPtrW(hwnd, 0, 0);
   return 0;
 }
 

reactos/lib/comctl32
nativefont.c 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- nativefont.c	6 Oct 2003 16:13:26 -0000	1.2
+++ nativefont.c	19 Sep 2004 09:50:06 -0000	1.3
@@ -45,7 +45,7 @@
     DWORD  dwDummy;   /* just to keep the compiler happy ;-) */
 } NATIVEFONT_INFO;
 
-#define NATIVEFONT_GetInfoPtr(hwnd) ((NATIVEFONT_INFO *)GetWindowLongA (hwnd, 0))
+#define NATIVEFONT_GetInfoPtr(hwnd) ((NATIVEFONT_INFO *)GetWindowLongPtrW (hwnd, 0))
 
 
 static LRESULT
@@ -55,7 +55,7 @@
 
     /* allocate memory for info structure */
     infoPtr = (NATIVEFONT_INFO *)Alloc (sizeof(NATIVEFONT_INFO));
-    SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
+    SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
 
 
     /* initialize info structure */
@@ -75,7 +75,7 @@
 
     /* free comboex info data */
     Free (infoPtr);
-    SetWindowLongA( hwnd, 0, 0 );
+    SetWindowLongPtrW( hwnd, 0, 0 );
 
     return 0;
 }

reactos/lib/comctl32
pager.c 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- pager.c	17 Dec 2003 18:09:54 -0000	1.3
+++ pager.c	19 Sep 2004 09:50:06 -0000	1.4
@@ -59,7 +59,7 @@
     INT    direction;  /* direction of the scroll, (e.g. PGF_SCROLLUP) */
 } PAGER_INFO;
 
-#define PAGER_GetInfoPtr(hwnd) ((PAGER_INFO *)GetWindowLongA(hwnd, 0))
+#define PAGER_GetInfoPtr(hwnd) ((PAGER_INFO *)GetWindowLongPtrW(hwnd, 0))
 #define PAGER_IsHorizontal(hwnd) ((GetWindowLongA (hwnd, GWL_STYLE) & PGS_HORZ))
 
 #define MIN_ARROW_WIDTH  8
@@ -330,12 +330,12 @@
     NMPGCALCSIZE nmpgcs;
     ZeroMemory (&nmpgcs, sizeof (NMPGCALCSIZE));
     nmpgcs.hdr.hwndFrom = hwnd;
-    nmpgcs.hdr.idFrom   = GetWindowLongA (hwnd, GWL_ID);
+    nmpgcs.hdr.idFrom   = GetWindowLongPtrW (hwnd, GWLP_ID);
     nmpgcs.hdr.code = PGN_CALCSIZE;
     nmpgcs.dwFlag = getWidth ? PGF_CALCWIDTH : PGF_CALCHEIGHT;
     nmpgcs.iWidth = getWidth ? *size : 0;
     nmpgcs.iHeight = getWidth ? 0 : *size;
-    SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,
+    SendMessageW (infoPtr->hwndNotify, WM_NOTIFY,
                   (WPARAM)nmpgcs.hdr.idFrom, (LPARAM)&nmpgcs);
 
     *size = getWidth ? nmpgcs.iWidth : nmpgcs.iHeight;
@@ -515,7 +515,7 @@
     }
 
     if (repaintBtns)
-        SendMessageA(hwnd, WM_NCPAINT, 0, 0);
+        SendMessageW(hwnd, WM_NCPAINT, 0, 0);
 }
 
 static LRESULT
@@ -571,7 +571,7 @@
 	return 0;
     }
 
-    DefWindowProcA (hwnd, WM_WINDOWPOSCHANGING, wParam, (LPARAM)winpos);
+    DefWindowProcW (hwnd, WM_WINDOWPOSCHANGING, wParam, (LPARAM)winpos);
 
     return 1;
 }
@@ -643,8 +643,8 @@
  * this module), the native control does only the following:      *
  *                                                                *
  *    if (some condition)                                         *
- *          PostMessageA(hwnd, EM_FMTLINES, 0, 0);                *
- *    return DefWindowProcA(hwnd, PGM_RECALCSIZE, 0, 0);          *
+ *          PostMessageW(hwnd, EM_FMTLINES, 0, 0);                *
+ *    return DefWindowProcW(hwnd, PGM_RECALCSIZE, 0, 0);          *
  *                                                                *
  * When we figure out what the "some condition" is we will        *
  * implement that for the message processing.                     *
@@ -777,7 +777,7 @@
     {
         ZeroMemory (&nmpgScroll, sizeof (NMPGSCROLL));
         nmpgScroll.hdr.hwndFrom = hwnd;
-        nmpgScroll.hdr.idFrom   = GetWindowLongA (hwnd, GWL_ID);
+        nmpgScroll.hdr.idFrom   = GetWindowLongPtrW (hwnd, GWLP_ID);
         nmpgScroll.hdr.code = PGN_SCROLL;
 
         GetWindowRect(hwnd, &rcWnd);
@@ -797,7 +797,7 @@
         }
         nmpgScroll.iScroll -= 2*infoPtr->nButtonSize;
 
-        SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,
+        SendMessageW (infoPtr->hwndNotify, WM_NOTIFY,
                     (WPARAM)nmpgScroll.hdr.idFrom, (LPARAM)&nmpgScroll);
 
         TRACE("[%p] PGN_SCROLL returns iScroll=%d\n", hwnd, nmpgScroll.iScroll);
@@ -830,7 +830,7 @@
 		 0,0,infoPtr->nWidth,infoPtr->nHeight,
 		 0);
 
-    return DefWindowProcA (hwnd, EM_FMTLINES, 0, 0);
+    return DefWindowProcW (hwnd, EM_FMTLINES, 0, 0);
 }
 
 static LRESULT
@@ -841,7 +841,7 @@
 
     /* allocate memory for info structure */
     infoPtr = (PAGER_INFO *)Alloc (sizeof(PAGER_INFO));
-    SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
+    SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
 
     /* set default settings */
     infoPtr->hwndChild = NULL;
@@ -882,7 +882,7 @@
     PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
     /* free pager info data */
     Free (infoPtr);
-    SetWindowLongA (hwnd, 0, 0);
+    SetWindowLongPtrW (hwnd, 0, 0);
     return 0;
 }
 
@@ -904,7 +904,7 @@
      * coordinates of the corresponding window's client area.
      */
 
-    DefWindowProcA (hwnd, WM_NCCALCSIZE, wParam, lParam);
+    DefWindowProcW (hwnd, WM_NCCALCSIZE, wParam, lParam);
 
     TRACE("orig rect=(%ld,%ld)-(%ld,%ld)\n",
 	  lpRect->left, lpRect->top, lpRect->right, lpRect->bottom);
@@ -1029,7 +1029,7 @@
     if (dwStyle & WS_MINIMIZE)
         return 0;
 
-    DefWindowProcA (hwnd, WM_NCPAINT, wParam, lParam);
+    DefWindowProcW (hwnd, WM_NCPAINT, wParam, lParam);
 
     if (!(hdc = GetDCEx (hwnd, 0, DCX_USESTYLE | DCX_WINDOW)))
         return 0;
@@ -1155,7 +1155,7 @@
     {
 	PAGER_CaptureandTrack(infoPtr, hwnd);
 
-        SendMessageA(hwnd, WM_NCPAINT, 0, 0);
+        SendMessageW(hwnd, WM_NCPAINT, 0, 0);
     }
 
     return TRUE;
@@ -1178,9 +1178,9 @@
         NMHDR nmhdr;
         ZeroMemory (&nmhdr, sizeof (NMHDR));
         nmhdr.hwndFrom = hwnd;
-        nmhdr.idFrom   = GetWindowLongA (hwnd, GWL_ID);
+        nmhdr.idFrom   = GetWindowLongPtrW (hwnd, GWLP_ID);
         nmhdr.code = NM_RELEASEDCAPTURE;
-        SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,
+        SendMessageW (infoPtr->hwndNotify, WM_NOTIFY,
                         (WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr);
     }
 
@@ -1253,7 +1253,7 @@
 	    PAGER_DrawButton(hdc, infoPtr->clrBk, *btnrect,
 			     PAGER_IsHorizontal(hwnd), topLeft, btnstate);
 	    ReleaseDC(hwnd, hdc);
-	    return DefWindowProcA (hwnd, WM_MOUSEMOVE, wParam, lParam);
+	    return DefWindowProcW (hwnd, WM_MOUSEMOVE, wParam, lParam);
 	}
     }
 
@@ -1268,16 +1268,16 @@
 		NMHDR nmhdr;
 		ZeroMemory (&nmhdr, sizeof (NMHDR));
 		nmhdr.hwndFrom = hwnd;
-		nmhdr.idFrom   = GetWindowLongA (hwnd, GWL_ID);
+		nmhdr.idFrom   = GetWindowLongPtrW (hwnd, GWLP_ID);
 		nmhdr.code = NM_RELEASEDCAPTURE;
-		SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,
+		SendMessageW (infoPtr->hwndNotify, WM_NOTIFY,
 			      (WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr);
 	    }
 	}
 	if (IsWindow(hwnd))
 	    KillTimer(hwnd, TIMERID1);
     }
-    return DefWindowProcA (hwnd, WM_MOUSEMOVE, wParam, lParam);
+    return DefWindowProcW (hwnd, WM_MOUSEMOVE, wParam, lParam);
 }
 
 static LRESULT
@@ -1310,7 +1310,7 @@
     }
 
     if (repaintBtns)
-        SendMessageA(hwnd, WM_NCPAINT, 0, 0);
+        SendMessageW(hwnd, WM_NCPAINT, 0, 0);
 
     switch(hit)
     {
@@ -1417,7 +1417,7 @@
      *   pt.x=0; pt.y=0; ?????
      *   MapWindowPoints(pager, parent, &pt, 1)
      *   OffsetWindowOrgEx(hdc, pt.x, pt.y, &ptorg)
-     *   SendMessageA(parent, WM_ERASEBKGND, hdc, 0)
+     *   SendMessageW(parent, WM_ERASEBKGND, hdc, 0)
      *   SetWindowOrgEx(hdc, 0, 0, 0)
      */
 
@@ -1426,7 +1426,7 @@
     parent = GetParent(hwnd);
     MapWindowPoints(hwnd, parent, &pt, 1);
     OffsetWindowOrgEx (hdc, pt.x, pt.y, &ptorig);
-    SendMessageA (parent, WM_ERASEBKGND, wParam, lParam);
+    SendMessageW (parent, WM_ERASEBKGND, wParam, lParam);
     SetWindowOrgEx (hdc, ptorig.x, ptorig.y, 0);
 
 
@@ -1475,7 +1475,7 @@
     PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
 
     if (!infoPtr && (uMsg != WM_CREATE))
-	return DefWindowProcA (hwnd, uMsg, wParam, lParam);
+	return DefWindowProcW (hwnd, uMsg, wParam, lParam);
 
     switch (uMsg)
     {
@@ -1551,7 +1551,7 @@
 
         case WM_MOUSEMOVE:
             if (infoPtr->bForward && infoPtr->hwndChild)
-                PostMessageA(infoPtr->hwndChild, WM_MOUSEMOVE, wParam, lParam);
+                PostMessageW(infoPtr->hwndChild, WM_MOUSEMOVE, wParam, lParam);
             return PAGER_MouseMove (hwnd, wParam, lParam);
 
         case WM_MOUSELEAVE:
@@ -1578,10 +1578,10 @@
 
         case WM_NOTIFY:
         case WM_COMMAND:
-            return SendMessageA (infoPtr->hwndNotify, uMsg, wParam, lParam);
+            return SendMessageW (infoPtr->hwndNotify, uMsg, wParam, lParam);
 
         default:
-            return DefWindowProcA (hwnd, uMsg, wParam, lParam);
+            return DefWindowProcW (hwnd, uMsg, wParam, lParam);
     }
 
     return 0;
@@ -1591,23 +1591,23 @@
 VOID
 PAGER_Register (void)
 {
-    WNDCLASSA wndClass;
+    WNDCLASSW wndClass;
 
-    ZeroMemory (&wndClass, sizeof(WNDCLASSA));
-    wndClass.style         = CS_GLOBALCLASS | CS_DBLCLKS | CS_SAVEBITS;
-    wndClass.lpfnWndProc   = (WNDPROC)PAGER_WindowProc;
+    ZeroMemory (&wndClass, sizeof(WNDCLASSW));
+    wndClass.style         = CS_GLOBALCLASS;
+    wndClass.lpfnWndProc   = PAGER_WindowProc;
     wndClass.cbClsExtra    = 0;
     wndClass.cbWndExtra    = sizeof(PAGER_INFO *);
-    wndClass.hCursor       = LoadCursorA (0, (LPSTR)IDC_ARROW);
-    wndClass.hbrBackground = 0;
-    wndClass.lpszClassName = WC_PAGESCROLLERA;
+    wndClass.hCursor       = LoadCursorW (0, (LPWSTR)IDC_ARROW);
+    wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE+1);
+    wndClass.lpszClassName = WC_PAGESCROLLERW;
 
-    RegisterClassA (&wndClass);
+    RegisterClassW (&wndClass);
 }
 
 
 VOID
 PAGER_Unregister (void)
 {
-    UnregisterClassA (WC_PAGESCROLLERA, NULL);
+    UnregisterClassW (WC_PAGESCROLLERW, NULL);
 }

reactos/lib/comctl32
progress.c 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- progress.c	9 Aug 2004 15:09:17 -0000	1.6
+++ progress.c	19 Sep 2004 09:50:06 -0000	1.7
@@ -499,7 +499,7 @@
 
     TRACE("hwnd=%p msg=%04x wparam=%x lParam=%lx\n", hwnd, message, wParam, lParam);
 
-    infoPtr = (PROGRESS_INFO *)GetWindowLongW(hwnd, 0);
+    infoPtr = (PROGRESS_INFO *)GetWindowLongPtrW(hwnd, 0);
 
     if (!infoPtr && message != WM_CREATE)
         return DefWindowProcW( hwnd, message, wParam, lParam );
@@ -518,7 +518,7 @@
         /* allocate memory for info struct */
         infoPtr = (PROGRESS_INFO *)Alloc (sizeof(PROGRESS_INFO));
         if (!infoPtr) return -1;
-        SetWindowLongW (hwnd, 0, (DWORD)infoPtr);
+        SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
 
         /* initialize the info struct */
         infoPtr->Self = hwnd;
@@ -538,7 +538,7 @@
     case WM_DESTROY:
         TRACE("Progress Ctrl destruction, hwnd=%p\n", hwnd);
         Free (infoPtr);
-        SetWindowLongW(hwnd, 0, 0);
+        SetWindowLongPtrW(hwnd, 0, 0);
         return 0;
 
     case WM_GETFONT:

reactos/lib/comctl32
propsheet.c 1.12 -> 1.13
diff -u -r1.12 -r1.13
--- propsheet.c	14 Aug 2004 19:12:35 -0000	1.12
+++ propsheet.c	19 Sep 2004 09:50:06 -0000	1.13
@@ -4,6 +4,7 @@
  * Copyright 1998 Francis Beaudet
  * Copyright 1999 Thuy Nguyen
  * Copyright 2004 Maxime Bellenge
+ * Copyright 2004 Filip Navara
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -19,9 +20,42 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
+ * This code was audited for completeness against the documented features
+ * of Comctl32.dll version 6.0 on Sep. 12, 2004, by Filip Navara.
+ * 
+ * Unless otherwise noted, we believe this code to be complete, as per
+ * the specification mentioned above.
+ * If you discover missing features, or bugs, please note them below.
+ *
  * TODO:
  *   - Tab order
- *   - Unicode property sheets
+ *   - Wizard 97 header resizing
+ *   - Enforcing of minimal wizard size
+ *   - Messages:
+ *     o PSM_GETRESULT
+ *     o PSM_IDTOINDEX
+ *     o PSM_INDEXTOID
+ *     o PSM_INDEXTOPAGE
+ *     o PSM_INSERTPAGE
+ *     o PSM_PAGETOINDEX
+ *     o PSM_RECALCPAGESIZES
+ *     o PSM_SETHEADERSUBTITLE
+ *     o PSM_SETHEADERTITLE
+ *   - Notifications:
+ *     o PSN_GETOBJECT
+ *     o PSN_QUERYINITIALFOCUS
+ *     o PSN_TRANSLATEACCELERATOR
+ *   - Styles:
+ *     o PSH_WIZARDHASFINISH
+ *     o PSH_RTLREADING
+ *     o PSH_WIZARDCONTEXTHELP
+ *     o PSH_STRETCHWATERMARK
+ *     o PSH_USEPAGELANG
+ *     o PSH_NOCONTEXTHELP
+ *     o PSH_USEPSTARTPAGE
+ *   - Page styles:
+ *     o PSP_USEFUSIONCONTEXT
+ *     o PSP_USEREFPARENT
  */
 
 #include <stdarg.h>
@@ -97,8 +131,6 @@
   PropPageInfo* proppage;
   HFONT hFont;
   HFONT hFontBold;
-  int x;
-  int y;
   int width;
   int height;
   HIMAGELIST hImageList;
@@ -125,6 +157,10 @@
 
 #define INTRNL_ANY_WIZARD (PSH_WIZARD | PSH_WIZARD97_OLD | PSH_WIZARD97_NEW | PSH_WIZARD_LITE)
 
+/* Wizard metrics specified in DLUs */
+#define WIZARD_PADDING 7
+#define WIZARD_HEADER_HEIGHT 36
+                         	
 /******************************************************************************
  * Prototypes
  */
@@ -199,30 +235,19 @@
 
   /*
    * unhandled header flags:
-   *  PSH_DEFAULT            0x00000000
    *  PSH_WIZARDHASFINISH    0x00000010
    *  PSH_RTLREADING         0x00000800
    *  PSH_WIZARDCONTEXTHELP  0x00001000
-   *  PSH_WIZARD97           0x00002000  (pre IE 5)
-   *  PSH_WATERMARK          0x00008000
-   *  PSH_USEHBMWATERMARK    0x00010000
-   *  PSH_USEHPLWATERMARK    0x00020000
    *  PSH_STRETCHWATERMARK   0x00040000
-   *  PSH_HEADER             0x00080000
-   *  PSH_USEHBMHEADER       0x00100000
    *  PSH_USEPAGELANG        0x00200000
-   *  PSH_WIZARD_LITE        0x00400000      also not in .h
-   *  PSH_WIZARD97           0x01000000  (IE 5 and above)
    *  PSH_NOCONTEXTHELP      0x02000000      also not in .h
    */
 
     add_flag(PSH_WIZARDHASFINISH);
     add_flag(PSH_RTLREADING);
     add_flag(PSH_WIZARDCONTEXTHELP);
-    add_flag(PSH_WIZARD97_OLD);
     add_flag(PSH_STRETCHWATERMARK);
     add_flag(PSH_USEPAGELANG);
-    add_flag(PSH_WIZARD_LITE);
     add_flag(PSH_NOCONTEXTHELP);
     if (string[0] != '\0')
 	FIXME("%s\n", string);
@@ -234,13 +259,43 @@
  *
  * Retrieve rect from tab control and map into the dialog for SetWindowPos
  */
-static void PROPSHEET_GetPageRect(const PropSheetInfo * psInfo, HWND hwndDlg, RECT *rc)
+static void PROPSHEET_GetPageRect(const PropSheetInfo * psInfo, HWND hwndDlg,
+                                  RECT *rc, LPCPROPSHEETPAGEW ppshpage)
 {
-    HWND hwndTabCtrl = GetDlgItem(hwndDlg, IDC_TABCONTROL);
-
-    GetClientRect(hwndTabCtrl, rc);
-    SendMessageW(hwndTabCtrl, TCM_ADJUSTRECT, FALSE, (LPARAM)rc);
-    MapWindowPoints(hwndTabCtrl, hwndDlg, (LPPOINT)rc, 2);
+    if (psInfo->ppshheader.dwFlags & INTRNL_ANY_WIZARD) {     
+        HWND hwndChild;
+        RECT r;
+
+        if (((psInfo->ppshheader.dwFlags & (PSH_WIZARD97_NEW | PSH_WIZARD97_OLD)) &&
+             (psInfo->ppshheader.dwFlags & PSH_HEADER) &&
+             !(ppshpage->dwFlags & PSP_HIDEHEADER)) ||
+            (psInfo->ppshheader.dwFlags & PSH_WIZARD))
+        {
+            rc->left = rc->top = WIZARD_PADDING;
+        }
+        else
+        {
+            rc->left = rc->top = 0;
+        }
+        rc->right = psInfo->width - rc->left;
+        rc->bottom = psInfo->height - rc->top;
+        MapDialogRect(hwndDlg, rc);
+
+        if ((psInfo->ppshheader.dwFlags & (PSH_WIZARD97_NEW | PSH_WIZARD97_OLD)) &&
+            (psInfo->ppshheader.dwFlags & PSH_HEADER) &&
+            !(ppshpage->dwFlags & PSP_HIDEHEADER))
+        {
+            hwndChild = GetDlgItem(hwndDlg, IDC_SUNKEN_LINEHEADER);
+            GetClientRect(hwndChild, &r);
+            MapWindowPoints(hwndChild, hwndDlg, (LPPOINT) &r, 2);
+            rc->top += r.bottom + 1;
+        }
+    } else {
+        HWND hwndTabCtrl = GetDlgItem(hwndDlg, IDC_TABCONTROL);
+        GetClientRect(hwndTabCtrl, rc);
+        SendMessageW(hwndTabCtrl, TCM_ADJUSTRECT, FALSE, (LPARAM)rc);
+        MapWindowPoints(hwndTabCtrl, hwndDlg, (LPPOINT)rc, 2);
+    }
 }
 
 /******************************************************************************
@@ -476,6 +531,23 @@
   width  = (WORD)*p; p++;
   height = (WORD)*p; p++;
 
+  /* Special calculation for interior wizard pages so the largest page is
+   * calculated correctly. We need to add all the padding and space occupied
+   * by the header so the width and height sums up to the whole wizard client
+   * area. */
+  if ((psInfo->ppshheader.dwFlags & (PSH_WIZARD97_OLD | PSH_WIZARD97_NEW)) &&
+      (psInfo->ppshheader.dwFlags & PSH_HEADER) &&
+      !(dwFlags & PSP_HIDEHEADER))
+  {
+      height += 2 * WIZARD_PADDING + WIZARD_HEADER_HEIGHT;
+      width += 2 * WIZARD_PADDING;
+  }
+  if (psInfo->ppshheader.dwFlags & PSH_WIZARD)
+  {
+      height += 2 * WIZARD_PADDING;
+      width += 2 * WIZARD_PADDING;
+  }
+
   /* remember the largest width and height */
   if (width > psInfo->width)
     psInfo->width = width;
@@ -683,8 +755,8 @@
   /*
    * Biggest page size.
    */
-  rcPage.left   = psInfo->x;
-  rcPage.top    = psInfo->y;
+  rcPage.left   = 0;
+  rcPage.top    = 0;
   rcPage.right  = psInfo->width;
   rcPage.bottom = psInfo->height;
 
@@ -701,49 +773,6 @@
 }
 
 /******************************************************************************
- *            PROPSHEET_IsTooSmallWizard
- *
- * Verify that the default property sheet is big enough.
- */
-static BOOL PROPSHEET_IsTooSmallWizard(HWND hwndDlg, PropSheetInfo* psInfo)
-{
-  RECT rcSheetRect, rcPage, rcLine, rcSheetClient;
-  HWND hwndLine = GetDlgItem(hwndDlg, IDC_SUNKEN_LINE);
-  PADDING_INFO padding = PROPSHEET_GetPaddingInfoWizard(hwndDlg, psInfo);
-
-  GetClientRect(hwndDlg, &rcSheetClient);
-  GetWindowRect(hwndDlg, &rcSheetRect);
-  GetWindowRect(hwndLine, &rcLine);
-
-  /* Remove the space below the sunken line */
-  rcSheetClient.bottom -= (rcSheetRect.bottom - rcLine.top);
-
-  /* Remove the buffer zone all around the edge */
-  rcSheetClient.bottom -= (padding.y * 2);
-  rcSheetClient.right -= (padding.x * 2);
-
-  /*
-   * Biggest page size.
-   */
-  rcPage.left   = psInfo->x;
-  rcPage.top    = psInfo->y;
-  rcPage.right  = psInfo->width;
-  rcPage.bottom = psInfo->height;
-
-  MapDialogRect(hwndDlg, &rcPage);
-  TRACE("biggest page %ld %ld %ld %ld\n", rcPage.left, rcPage.top,
-        rcPage.right, rcPage.bottom);
-
-  if (rcPage.right > rcSheetClient.right)
-    return TRUE;
-
-  if (rcPage.bottom > rcSheetClient.bottom)
-    return TRUE;
-
-  return FALSE;
-}
-
-/******************************************************************************
  *            PROPSHEET_AdjustSize
  *
  * Resizes the property sheet and the tab control to fit the largest page.
@@ -764,8 +793,8 @@
   /*
    * Biggest page size.
    */
-  rc.left   = psInfo->x;
-  rc.top    = psInfo->y;
+  rc.left   = 0;
+  rc.top    = 0;
   rc.right  = psInfo->width;
   rc.bottom = psInfo->height;
 
@@ -832,69 +861,33 @@
  */
 static BOOL PROPSHEET_AdjustSizeWizard(HWND hwndDlg, PropSheetInfo* psInfo)
 {
-  HWND hwndButton = GetDlgItem(hwndDlg, IDCANCEL);
   HWND hwndLine = GetDlgItem(hwndDlg, IDC_SUNKEN_LINE);
-  HWND hwndTabCtrl = GetDlgItem(hwndDlg, IDC_TABCONTROL);
-  RECT rc,tabRect;
-  int buttonHeight, lineHeight;
-  PADDING_INFO padding = PROPSHEET_GetPaddingInfoWizard(hwndDlg, psInfo);
-  RECT units;
-
-  /* Get the height of buttons */
-  GetClientRect(hwndButton, &rc);
-  buttonHeight = rc.bottom;
-
-  GetClientRect(hwndLine, &rc);
-  lineHeight = rc.bottom;
-
-  /* retrieve the dialog units */
-  units.left = units.right = 4;
-  units.top = units.bottom = 8;
-  MapDialogRect(hwndDlg, &units);
+  RECT rc, lineRect, dialogRect;
 
-  /*
-   * Biggest page size.
-   */
-  rc.left   = psInfo->x;
-  rc.top    = psInfo->y;
+  /* Biggest page size */
+  rc.left   = 0;
+  rc.top    = 0;
   rc.right  = psInfo->width;
   rc.bottom = psInfo->height;
-
   MapDialogRect(hwndDlg, &rc);
 
-  GetClientRect(hwndTabCtrl,&tabRect);
-
-  if ((rc.bottom - rc.top) < (tabRect.bottom - tabRect.top))
-  {
-      rc.bottom = rc.top + tabRect.bottom - tabRect.top;
-      psInfo->height = MulDiv((rc.bottom - rc.top), 8, units.top);
-  }
-
-  if ((rc.right - rc.left) < (tabRect.right - tabRect.left))
-  {
-      rc.right = rc.left + tabRect.right - tabRect.left;
-      psInfo->width  = MulDiv((rc.right - rc.left), 4, units.left);
-  }
-
   TRACE("Biggest page %ld %ld %ld %ld\n", rc.left, rc.top, rc.right, rc.bottom);
-  TRACE("   constants padx=%d, pady=%d, butH=%d, lH=%d\n",
-	padding.x, padding.y, buttonHeight, lineHeight);
 
-  /* Make room */
-  rc.right += (padding.x * 2);
-  rc.bottom += (buttonHeight + lineHeight);
-  if (psInfo->ppshheader.dwFlags & (PSH_WIZARD97_OLD | PSH_WIZARD97_NEW))
-      rc.bottom += (4 * padding.y);
-  else 
-      rc.bottom += (5 * padding.y);
+  /* Add space for the buttons row */
+  GetWindowRect(hwndLine, &lineRect);
+  MapWindowPoints(NULL, hwndDlg, (LPPOINT)&lineRect, 2);
+  GetClientRect(hwndDlg, &dialogRect);
+  rc.bottom += dialogRect.bottom - lineRect.top - 1;
 
-  /*
-   * Resize the property sheet.
-   */
+  /* Convert the client coordinates to window coordinates */
+  AdjustWindowRect(&rc, GetWindowLongW(hwndDlg, GWL_STYLE), FALSE);
+
+  /* Resize the property sheet */
   TRACE("setting dialog %08lx, rc (0,0)-(%ld,%ld)\n",
         (DWORD)hwndDlg, rc.right, rc.bottom);
-  SetWindowPos(hwndDlg, 0, 0, 0, rc.right, rc.bottom,
+  SetWindowPos(hwndDlg, 0, 0, 0, rc.right - rc.left, rc.bottom - rc.top,
                SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
+
   return TRUE;
 }
 
@@ -936,7 +929,7 @@
   y = rcSheet.bottom - (padding.y + buttonHeight);
 
   /*
-   * Position OK button.
+   * Position OK button and make it default.
    */
   hwndButton = GetDlgItem(hwndParent, IDOK);
 
@@ -945,6 +938,9 @@
   SetWindowPos(hwndButton, 0, x, y, 0, 0,
                SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
 
+  SendMessageA(hwndParent, DM_SETDEFID, IDOK, 0);
+
+
   /*
    * Position Cancel button.
    */
@@ -1085,7 +1081,8 @@
   else
     ShowWindow(hwndButton, SW_HIDE);
 
-  if (psInfo->ppshheader.dwFlags & (PSH_WIZARD97_OLD | PSH_WIZARD97_NEW)) 
+  if (psInfo->ppshheader.dwFlags &
+      (PSH_WIZARD97_OLD | PSH_WIZARD97_NEW | PSH_WIZARD_LITE)) 
       padding.x = 0;
 
   /*
@@ -1095,7 +1092,6 @@
   y = rcSheet.bottom - ((padding.y * 2) + buttonHeight + lineHeight);
 
   lineWidth = rcSheet.right - (padding.x * 2);
-
   SetWindowPos(hwndLine, 0, x, y, lineWidth, 2,
                SWP_NOZORDER | SWP_NOACTIVATE);
 
@@ -1249,6 +1245,29 @@
 
   return TRUE;
 }
+
+/******************************************************************************
+ *            PROPSHEET_WizardSubclassProc
+ *
+ * Subclassing window procedure for wizard extrior pages to prevent drawing
+ * background and so drawing above the watermark.
+ */
+LRESULT CALLBACK
+PROPSHEET_WizardSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uID, DWORD_PTR dwRef)
+{
+  switch (uMsg)
+  {
+    case WM_ERASEBKGND:
+      return TRUE;
+
+    case WM_CTLCOLORSTATIC:
+      SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
+      return (INT_PTR)GetSysColorBrush(COLOR_WINDOW);
+  }
+
+  return DefSubclassProc(hwnd, uMsg, wParam, lParam);
+}
+
 /*
  * Get the size of an in-memory Template
  *
@@ -1373,7 +1392,7 @@
 	  p += lstrlenW( (LPCWSTR)p ) + 1;
 	  break;
 	}
-      p += *p + 1;    /* Skip extra data */
+      p += *p / sizeof(WORD) + 1;    /* Skip extra data */
       --nrofitems;
     }
   
@@ -1394,9 +1413,6 @@
 {
   DLGTEMPLATE* pTemplate;
   HWND hwndPage;
-  RECT rc;
-  PADDING_INFO padding;
-  UINT pageWidth,pageHeight;
   DWORD resSize;
   LPVOID temp = NULL;
 
@@ -1466,7 +1482,7 @@
 
   if (((MyDLGTEMPLATEEX*)pTemplate)->signature == 0xFFFF)
   {
-    ((MyDLGTEMPLATEEX*)pTemplate)->style |= WS_CHILD | DS_CONTROL;
+    ((MyDLGTEMPLATEEX*)pTemplate)->style |= WS_CHILD | WS_TABSTOP | DS_CONTROL;
     ((MyDLGTEMPLATEEX*)pTemplate)->style &= ~DS_MODALFRAME;
     ((MyDLGTEMPLATEEX*)pTemplate)->style &= ~WS_CAPTION;
     ((MyDLGTEMPLATEEX*)pTemplate)->style &= ~WS_SYSMENU;
@@ -1474,10 +1490,12 @@
     ((MyDLGTEMPLATEEX*)pTemplate)->style &= ~WS_DISABLED;
     ((MyDLGTEMPLATEEX*)pTemplate)->style &= ~WS_VISIBLE;
     ((MyDLGTEMPLATEEX*)pTemplate)->style &= ~WS_THICKFRAME;
+
+    ((MyDLGTEMPLATEEX*)pTemplate)->exStyle |= WS_EX_CONTROLPARENT;
   }
   else
   {
-    pTemplate->style |= WS_CHILD | DS_CONTROL;
+    pTemplate->style |= WS_CHILD | WS_TABSTOP | DS_CONTROL;
     pTemplate->style &= ~DS_MODALFRAME;
     pTemplate->style &= ~WS_CAPTION;
     pTemplate->style &= ~WS_SYSMENU;
@@ -1485,6 +1503,8 @@
     pTemplate->style &= ~WS_DISABLED;
     pTemplate->style &= ~WS_VISIBLE;
     pTemplate->style &= ~WS_THICKFRAME;
+
+    pTemplate->dwExtendedStyle |= WS_EX_CONTROLPARENT;
   }
 
   if (psInfo->proppage[index].useCallback)
@@ -1509,67 +1529,13 @@
 
   psInfo->proppage[index].hwndPage = hwndPage;
 
-  if (psInfo->ppshheader.dwFlags & INTRNL_ANY_WIZARD) {     
-      int offsety = 0;
-      HWND hwndChild;
-      RECT r;
-
-      rc.left = psInfo->x;
-      rc.top = psInfo->y;
-      rc.right = psInfo->width;
-      rc.bottom = psInfo->height;
-
-      MapDialogRect(hwndParent, &rc);
-
-      pageWidth = rc.right - rc.left;
-      pageHeight = rc.bottom - rc.top;
-
-      padding = PROPSHEET_GetPaddingInfoWizard(hwndParent, psInfo);
-      TRACE("setting page %08lx, rc (%ld,%ld)-(%ld,%ld) w=%d, h=%d, padx=%d, pady=%d\n",
-	    (DWORD)hwndPage, rc.left, rc.top, rc.right, rc.bottom,
-	    pageWidth, pageHeight, padding.x, padding.y);
-
-      if (psInfo->ppshheader.dwFlags & (PSH_WIZARD97_NEW | PSH_WIZARD97_OLD) &&
-          psInfo->ppshheader.dwFlags & PSH_HEADER)
-      {
-	  if ((ppshpage->dwFlags & PSP_USEHEADERTITLE) &&
-	      (HIWORD(ppshpage->pszHeaderTitle) == 0))
-	  {
-	    /* FIXME: load title string into ppshpage->pszHeaderTitle */
-	  }
-
-	  if ((ppshpage->dwFlags & PSP_USEHEADERSUBTITLE) &&
-	      (HIWORD(ppshpage->pszHeaderSubTitle) == 0))
-	  {
-	    /* FIXME: load title string into ppshpage->pszHeaderSubTitle */
-	  }
-
-	  hwndChild = GetDlgItem(hwndParent, IDC_SUNKEN_LINEHEADER);
-
-	  GetClientRect(hwndChild, &r);
-	  MapWindowPoints(hwndChild, hwndParent, (LPPOINT) &r, 2);
-	  offsety = (ppshpage->dwFlags & PSP_HIDEHEADER)?0:r.bottom + 1;
-      }
-
-      SetWindowPos(hwndPage, HWND_TOP,
-		   rc.left + padding.x/2,
-		   rc.top + padding.y/2 + offsety,
-		   pageWidth, pageHeight - offsety, 0);
-  }
-  else {
-      /*
-       * Ask the Tab control to reduce the client rectangle to that
-       * it has available.
-       */
-      PROPSHEET_GetPageRect(psInfo, hwndParent, &rc);
-      pageWidth = rc.right - rc.left;
-      pageHeight = rc.bottom - rc.top;
-      TRACE("setting page %08lx, rc (%ld,%ld)-(%ld,%ld) w=%d, h=%d\n",
-	    (DWORD)hwndPage, rc.left, rc.top, rc.right, rc.bottom,
-	    pageWidth, pageHeight);
-      SetWindowPos(hwndPage, HWND_TOP,
-		   rc.left, rc.top,
-		   pageWidth, pageHeight, 0);
+  /* Subclass exterior wizard pages */
+  if((psInfo->ppshheader.dwFlags & (PSH_WIZARD97_NEW | PSH_WIZARD97_OLD)) &&
+     (psInfo->ppshheader.dwFlags & PSH_WATERMARK) &&
+     (ppshpage->dwFlags & PSP_HIDEHEADER))
+  {
+      SetWindowSubclass(hwndPage, PROPSHEET_WizardSubclassProc, 1,
+                        (DWORD_PTR)ppshpage);
   }
 
   return TRUE;
@@ -1624,13 +1590,14 @@
       return TRUE;
   }
 
+  ppshpage = (LPCPROPSHEETPAGEW)psInfo->proppage[index].hpage;
   if (psInfo->proppage[index].hwndPage == 0)
   {
-     ppshpage = (LPCPROPSHEETPAGEW)psInfo->proppage[index].hpage;
      PROPSHEET_CreatePage(hwndDlg, index, psInfo, ppshpage);
   }
 
-  if ((psInfo->ppshheader.dwFlags & (PSH_WIZARD97_OLD | PSH_WIZARD97_NEW)) == 0)
+  if ((psInfo->ppshheader.dwFlags & INTRNL_ANY_WIZARD) &&
+      (ppshpage->dwFlags & PSP_USETITLE))
   {
      PROPSHEET_SetTitleW(hwndDlg, psInfo->ppshheader.dwFlags,
                          psInfo->proppage[index].pszText);
@@ -1658,11 +1625,11 @@
 	  ShowWindow(hwndLineHeader, SW_HIDE);
       else
 	  ShowWindow(hwndLineHeader, SW_SHOW);
-
-      InvalidateRgn(hwndDlg, NULL, TRUE);
-      UpdateWindow(hwndDlg);
   }
 
+  InvalidateRgn(hwndDlg, NULL, TRUE);
+  UpdateWindow(hwndDlg);
+
   return TRUE;
 }
 
@@ -2090,6 +2057,8 @@
   while (1) {
     int result;
     PSHNOTIFY psn;
+    RECT rc;
+    LPCPROPSHEETPAGEW ppshpage = (LPCPROPSHEETPAGEW)psInfo->proppage[index].hpage;
 
     if (hwndTabControl)
 	SendMessageW(hwndTabControl, TCM_SETCURSEL, index, 0);
@@ -2100,10 +2069,22 @@
     psn.lParam       = 0;
 
     if (!psInfo->proppage[index].hwndPage) {
-      LPCPROPSHEETPAGEW ppshpage = (LPCPROPSHEETPAGEW)psInfo->proppage[index].hpage;
       PROPSHEET_CreatePage(hwndDlg, index, psInfo, ppshpage);
     }
 
+    /* Resize the property sheet page to the fit in the Tab control
+     * (for regular property sheets) or to fit in the client area (for
+     * wizards).
+     * NOTE: The resizing happens every time the page is selected and
+     * not only when it's created (some applications depend on it). */
+    PROPSHEET_GetPageRect(psInfo, hwndDlg, &rc, ppshpage);
+    TRACE("setting page %p, rc (%ld,%ld)-(%ld,%ld) w=%ld, h=%ld\n",
+          psInfo->proppage[index].hwndPage, rc.left, rc.top, rc.right, rc.bottom,
+          rc.right - rc.left, rc.bottom - rc.top);
+    SetWindowPos(psInfo->proppage[index].hwndPage, HWND_TOP,
+                 rc.left, rc.top,
+                 rc.right - rc.left, rc.bottom - rc.top, 0);
+
     result = SendMessageW(psInfo->proppage[index].hwndPage, WM_NOTIFY, 0, (LPARAM) &psn);
     if (!result)
       break;
@@ -2411,6 +2392,15 @@
   else if (index < psInfo->active_page)
     psInfo->active_page--;
 
+  /* Unsubclass the page dialog window */
+  if((psInfo->ppshheader.dwFlags & (PSH_WIZARD97_NEW | PSH_WIZARD97_OLD) &&
+     (psInfo->ppshheader.dwFlags & PSH_WATERMARK) &&
+     ((PROPSHEETPAGEW*)psInfo->proppage[index].hpage)->dwFlags & PSP_HIDEHEADER))
+  {
+     RemoveWindowSubclass(psInfo->proppage[index].hwndPage,
+                          PROPSHEET_WizardSubclassProc, 1);
+  }
+
   /* Destroy page dialog window */
   DestroyWindow(psInfo->proppage[index].hwndPage);
 
@@ -2671,6 +2661,15 @@
   {
      PROPSHEETPAGEA* psp = (PROPSHEETPAGEA*)psInfo->proppage[i].hpage;
 
+     /* Unsubclass the page dialog window */
+     if((psInfo->ppshheader.dwFlags & (PSH_WIZARD97_NEW | PSH_WIZARD97_OLD)) &&
+        (psInfo->ppshheader.dwFlags & PSH_WATERMARK) &&
+        (psp->dwFlags & PSP_HIDEHEADER))
+     {
+        RemoveWindowSubclass(psInfo->proppage[i].hwndPage,
+                             PROPSHEET_WizardSubclassProc, 1);
+     }
+
      if(psInfo->proppage[i].hwndPage)
         DestroyWindow(psInfo->proppage[i].hwndPage);
 
@@ -2910,7 +2909,7 @@
      HeapFree(GetProcessHeap(), 0, (LPVOID)psp->u2.pszIcon);
 
   if ((psp->dwFlags & PSP_USETITLE) && HIWORD( psp->pszTitle ))
-      HeapFree(GetProcessHeap(), 0, (LPVOID)psp->pszTitle);
+     HeapFree(GetProcessHeap(), 0, (LPVOID)psp->pszTitle);
 
   Free(hPropPage);
 
@@ -3050,8 +3049,10 @@
     HPALETTE hOldPal = 0;
     int offsety = 0;
     HBRUSH hbr;
-    RECT r;
+    RECT r, rzone;
     LPCPROPSHEETPAGEW ppshpage;
+    WCHAR szBuffer[256];
+    int nLength;
 
     hdc = BeginPaint(hwnd, &ps);
     if (!hdc) return 1;
@@ -3066,18 +3067,17 @@
 	 (psInfo->ppshheader.dwFlags & (PSH_WIZARD97_OLD | PSH_WIZARD97_NEW)) &&
 	 (psInfo->ppshheader.dwFlags & PSH_HEADER) ) 
     {
-	RECT rzone;
 	HWND hwndLineHeader = GetDlgItem(hwnd, IDC_SUNKEN_LINEHEADER);
 	HFONT hOldFont;
 	COLORREF clrOld = 0;
 	int oldBkMode = 0;
 
 	hbmp = SelectObject(hdcSrc, psInfo->ppshheader.u5.hbmHeader);
-	hOldFont = SelectObject(hdc, psInfo->hFontBold);		
+	hOldFont = SelectObject(hdc, psInfo->hFontBold);
 
 	GetClientRect(hwndLineHeader, &r);
 	MapWindowPoints(hwndLineHeader, hwnd, (LPPOINT) &r, 2);
-	SetRect(&rzone, 0, 0, r.right, r.top - 1);
+	SetRect(&rzone, 0, 0, r.right + 1, r.top - 1);
 
 	GetObjectA(psInfo->ppshheader.u5.hbmHeader, sizeof(BITMAP), (LPVOID)&bm);		
 
@@ -3103,52 +3103,80 @@
  	        }
  	        DeleteObject(hbr);
  	    }
+
+ 	    /* Draw the header itself. */
+ 	    BitBlt(hdc, 0, 0,
+ 	           bm.bmWidth, min(bm.bmHeight, rzone.bottom),
+ 	           hdcSrc, 0, 0, SRCCOPY);
  	}
  	else
  	{
- 	    hbr = CreateSolidBrush(GetSysColor(COLOR_WINDOW));
+ 	    hbr = GetSysColorBrush(COLOR_WINDOW);
  	    FillRect(hdc, &rzone, hbr);
- 	    DeleteObject(hbr);
+
+ 	    /* Draw the header bitmap. It's always centered like a
+ 	     * common 49 x 49 bitmap. */
+ 	    BitBlt(hdc, rzone.right - 49 - ((rzone.bottom - 49) / 2),
+ 	           (rzone.bottom - 49) / 2,
+ 	           bm.bmWidth, bm.bmHeight,
+ 	           hdcSrc, 0, 0, SRCCOPY);
+
+ 	    /* NOTE: Native COMCTL32 draws a white stripe over the bitmap
+ 	     * if its height is smaller than 49 pixels. Because the reason
+ 	     * for this bug is unknown the current code doesn't try to
+ 	     * replicate it. */
  	}
- 
+
 	clrOld = SetTextColor (hdc, 0x00000000);
 	oldBkMode = SetBkMode (hdc, TRANSPARENT); 
 
-	if (ppshpage->dwFlags & PSP_USEHEADERTITLE) {	    
-	    SetRect(&r, 20, 10, rzone.right - bm.bmWidth, 18);
-	    if (psInfo->unicode)
-		DrawTextW(hdc, (LPWSTR)ppshpage->pszHeaderTitle, 
-			  -1, &r, DT_LEFT | DT_SINGLELINE | DT_NOCLIP);
+	if (ppshpage->dwFlags & PSP_USEHEADERTITLE) {
+	    SetRect(&r, 20, 10, 0, 0);
+	    if (HIWORD(ppshpage->pszHeaderTitle))
+	    {
+		if (psInfo->unicode)
+		    DrawTextW(hdc, (LPWSTR)ppshpage->pszHeaderTitle,
+			      -1, &r, DT_LEFT | DT_SINGLELINE | DT_NOCLIP);
+		else
+		    DrawTextA(hdc, (LPCSTR)ppshpage->pszHeaderTitle,
+			      -1, &r, DT_LEFT | DT_SINGLELINE | DT_NOCLIP);
+	    }
 	    else
-		DrawTextA(hdc, (LPCSTR)ppshpage->pszHeaderTitle, 
-			  -1, &r, DT_LEFT | DT_SINGLELINE | DT_NOCLIP);	
+	    {
+		nLength = LoadStringW(ppshpage->hInstance, (UINT)ppshpage->pszHeaderTitle,
+				      szBuffer, 256);
+		if (nLength != 0)
+		{
+		    DrawTextW(hdc, szBuffer, nLength,
+			      &r, DT_LEFT | DT_SINGLELINE | DT_NOCLIP);
+		}
+	    }
 	}
 
 	if (ppshpage->dwFlags & PSP_USEHEADERSUBTITLE) {
 	    SelectObject(hdc, psInfo->hFont);
-	    SetRect(&r, 40, 25, rzone.right - bm.bmWidth, 43);
-	    if (psInfo->unicode)
-		DrawTextW(hdc, (LPWSTR)ppshpage->pszHeaderSubTitle, 
-		      -1, &r, DT_LEFT | DT_SINGLELINE);
+	    SetRect(&r, 40, 25, rzone.right - 69, rzone.bottom);
+	    if (HIWORD(ppshpage->pszHeaderTitle))
+	    {
+		if (psInfo->unicode)
+		    DrawTextW(hdc, (LPWSTR)ppshpage->pszHeaderSubTitle,
+			      -1, &r, DT_LEFT | DT_SINGLELINE);
+		else
+		    DrawTextA(hdc, (LPCSTR)ppshpage->pszHeaderSubTitle,
+			      -1, &r, DT_LEFT | DT_SINGLELINE);
+	    }
 	    else
-		DrawTextA(hdc, (LPCSTR)ppshpage->pszHeaderSubTitle, 
-		      -1, &r, DT_LEFT | DT_SINGLELINE);	
+	    {
+		nLength = LoadStringW(ppshpage->hInstance, (UINT)ppshpage->pszHeaderSubTitle,
+				      szBuffer, 256);
+		if (nLength != 0)
+		{
+		    DrawTextW(hdc, szBuffer, nLength,
+			      &r, DT_LEFT | DT_SINGLELINE);
+		}
+	    }
 	}
 
- 	if (psInfo->ppshheader.dwFlags & PSH_WIZARD97_OLD)
- 	{
- 	    BitBlt(hdc, 0, 0,
- 	           bm.bmWidth, min(bm.bmHeight, rzone.bottom),
- 	           hdcSrc, 0, 0, SRCCOPY);
- 	}
- 	else
- 	{
- 	    BitBlt(hdc, rzone.right - bm.bmWidth,
- 	           (rzone.bottom - bm.bmHeight) / 2,
- 	           bm.bmWidth, bm.bmHeight,
- 	           hdcSrc, 0, 0, SRCCOPY);
- 	}
-
 	offsety = rzone.bottom + 2;
 
 	SetTextColor(hdc, clrOld);
@@ -3157,7 +3185,7 @@
 	SelectObject(hdcSrc, hbmp);
     }
 
-    if ( ((psInfo->active_page == 0) || (psInfo->active_page == psInfo->nPages - 1)) &&
+    if ( (ppshpage->dwFlags & PSP_HIDEHEADER) &&
 	 (psInfo->ppshheader.dwFlags & (PSH_WIZARD97_OLD | PSH_WIZARD97_NEW)) &&
 	 (psInfo->ppshheader.dwFlags & PSH_WATERMARK) ) 
     {
@@ -3166,6 +3194,14 @@
 	GetClientRect(hwndLine, &r);
 	MapWindowPoints(hwndLine, hwnd, (LPPOINT) &r, 2);
 
+	rzone.left = 0;
+	rzone.top = 0;
+	rzone.right = r.right;
+	rzone.bottom = r.top - 1;
+
+	hbr = GetSysColorBrush(COLOR_WINDOW);
+	FillRect(hdc, &rzone, hbr);
+
 	GetObjectA(psInfo->ppshheader.u4.hbmWatermark, sizeof(BITMAP), (LPVOID)&bm);
 	hbmp = SelectObject(hdcSrc, psInfo->ppshheader.u4.hbmWatermark);
 
@@ -3225,11 +3261,11 @@
       /*
        * psInfo->hwnd is not being used by WINE code - it exists
        * for compatibility with "real" Windoze. The same about
-       * SetWindowLong - WINE is only using the PropSheetInfoStr
+       * SetWindowLongPtr - WINE is only using the PropSheetInfoStr
        * property.
        */
       psInfo->hwnd = hwnd;
-      SetWindowLongW(hwnd,DWL_USER,(LONG)psInfo);
+      SetWindowLongPtrW(hwnd, DWLP_USER, (DWORD_PTR)psInfo);
 
       /* set up the Next and Back buttons by default */
       PROPSHEET_SetWizButtons(hwnd, PSWIZB_BACK|PSWIZB_NEXT);
@@ -3276,11 +3312,8 @@
       if (psInfo->ppshheader.dwFlags & INTRNL_ANY_WIZARD)
       {
         ShowWindow(hwndTabCtrl, SW_HIDE);
-        if (PROPSHEET_IsTooSmallWizard(hwnd, psInfo))
-        {
-          PROPSHEET_AdjustSizeWizard(hwnd, psInfo);
-          PROPSHEET_AdjustButtonsWizard(hwnd, psInfo);
-        }
+        PROPSHEET_AdjustSizeWizard(hwnd, psInfo);
+        PROPSHEET_AdjustButtonsWizard(hwnd, psInfo);
       }
       else
       {
@@ -3363,7 +3396,7 @@
       if(pnmh->code == TCN_SELCHANGING)
       {
         BOOL bRet = PROPSHEET_CanSetCurSel(hwnd);
-        SetWindowLongW(hwnd, DWL_MSGRESULT, !bRet);
+        SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, !bRet);
         return TRUE;
       }
 
@@ -3379,7 +3412,7 @@
       if (psInfo->activeValid && psInfo->active_page != -1)
         hwndPage = psInfo->proppage[psInfo->active_page].hwndPage;
 
-      SetWindowLongW(hwnd, DWL_MSGRESULT, (LONG)hwndPage);
+      SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, (DWORD_PTR)hwndPage);
 
       return TRUE;
     }
@@ -3396,7 +3429,7 @@
     {
       HWND hwndTabCtrl = GetDlgItem(hwnd, IDC_TABCONTROL);
 
-      SetWindowLongW(hwnd, DWL_MSGRESULT, (LONG)hwndTabCtrl);
+      SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, (DWORD_PTR)hwndTabCtrl);
 
       return TRUE;
     }
@@ -3414,7 +3447,7 @@
                                        (HPROPSHEETPAGE)lParam);
       }
 
-      SetWindowLongW(hwnd, DWL_MSGRESULT, msgResult);
+      SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult);
 
       return TRUE;
     }
@@ -3462,7 +3495,7 @@
     {
       BOOL msgResult = PROPSHEET_Apply(hwnd, 0);
 
-      SetWindowLongW(hwnd, DWL_MSGRESULT, msgResult);
+      SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult);
 
       return TRUE;
     }
@@ -3471,7 +3504,7 @@
     {
       LRESULT msgResult = PROPSHEET_QuerySiblings(hwnd, wParam, lParam);
 
-      SetWindowLongW(hwnd, DWL_MSGRESULT, msgResult);
+      SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult);
 
       return TRUE;
     }
@@ -3488,7 +3521,7 @@
 
       BOOL msgResult = PROPSHEET_AddPage(hwnd, (HPROPSHEETPAGE)lParam);
 
-      SetWindowLongW(hwnd, DWL_MSGRESULT, msgResult);
+      SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult);
 
       return TRUE;
     }
@@ -3500,7 +3533,7 @@
     case PSM_ISDIALOGMESSAGE:
     {
        BOOL msgResult = PROPSHEET_IsDialogMessage(hwnd, (LPMSG)lParam);
-       SetWindowLongA(hwnd, DWL_MSGRESULT, msgResult);
+       SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult);
        return TRUE;
     }
 
@@ -3527,7 +3560,7 @@
     case PSM_INSERTPAGE:
     {
         BOOL msgResult = PROPSHEET_InsertPage(hwnd, (HPROPSHEETPAGE)wParam, (HPROPSHEETPAGE)lParam);
-        SetWindowLongW(hwnd, DWL_MSGRESULT, msgResult);
+        SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult);
         return TRUE;
     }
 
@@ -3550,56 +3583,56 @@
     case PSM_HWNDTOINDEX:
     {
         LRESULT msgResult = PROPSHEET_HwndToIndex(hwnd, (HWND)wParam);
-        SetWindowLongW(hwnd, DWL_MSGRESULT, msgResult);
+        SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult);
         return TRUE;
     }
 
     case PSM_INDEXTOHWND:
     {
         LRESULT msgResult = PROPSHEET_IndexToHwnd(hwnd, (int)wParam);
-        SetWindowLongW(hwnd, DWL_MSGRESULT, msgResult);
+        SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult);
         return TRUE;
     }
 
     case PSM_PAGETOINDEX:
     {
         LRESULT msgResult = PROPSHEET_PageToIndex(hwnd, (HPROPSHEETPAGE)wParam);
-        SetWindowLongW(hwnd, DWL_MSGRESULT, msgResult);
+        SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult);
         return TRUE;
     }
 
     case PSM_INDEXTOPAGE:
     {
         LRESULT msgResult = PROPSHEET_IndexToPage(hwnd, (int)wParam);
-        SetWindowLongW(hwnd, DWL_MSGRESULT, msgResult);
+        SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult);
         return TRUE;
     }
 
     case PSM_IDTOINDEX:
     {
         LRESULT msgResult = PROPSHEET_IdToIndex(hwnd, (int)lParam);
-        SetWindowLongW(hwnd, DWL_MSGRESULT, msgResult);
+        SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult);
         return TRUE;
     }
 
     case PSM_INDEXTOID:
     {
         LRESULT msgResult = PROPSHEET_IndexToId(hwnd, (int)wParam);
-        SetWindowLongW(hwnd, DWL_MSGRESULT, msgResult);
+        SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult);
         return TRUE;
     }
 
     case PSM_GETRESULT:
     {
         LRESULT msgResult = PROPSHEET_GetResult(hwnd);
-        SetWindowLongW(hwnd, DWL_MSGRESULT, msgResult);
+        SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult);
         return TRUE;
     }
 
     case PSM_RECALCPAGESIZES:
     {
         LRESULT msgResult = PROPSHEET_RecalcPageSizes(hwnd);
-        SetWindowLongW(hwnd, DWL_MSGRESULT, msgResult);
+        SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult);
         return TRUE;
     }
 

reactos/lib/comctl32
rebar.c 1.11 -> 1.12
diff -u -r1.11 -r1.12
--- rebar.c	1 May 2004 21:22:18 -0000	1.11
+++ rebar.c	19 Sep 2004 09:50:06 -0000	1.12
@@ -333,7 +333,7 @@
                     else b->rcBand.left += (i); } while(0)
 
 
-#define REBAR_GetInfoPtr(wndPtr) ((REBAR_INFO *)GetWindowLongA (hwnd, 0))
+#define REBAR_GetInfoPtr(wndPtr) ((REBAR_INFO *)GetWindowLongPtrW (hwnd, 0))
 
 
 /* "constant values" retrieved when DLL was initialized    */
@@ -751,8 +751,8 @@
      /*   start and end bands are *not* hidden                       */
 {
     REBAR_BAND *lpBand;
-    UINT x, xsep, extra, curwidth, fudge;
-    INT i, last_adjusted;
+    UINT xsep, extra, curwidth, fudge;
+    INT x, i, last_adjusted;
 
     TRACE("start=%u, end=%u, max x=%d, max y=%d\n",
 	  rowstart, rowend, maxx, mcy);
@@ -3841,7 +3841,7 @@
     DeleteObject (infoPtr->hcurVert);
     DeleteObject (infoPtr->hcurDrag);
     if(infoPtr->hDefaultFont) DeleteObject (infoPtr->hDefaultFont);
-    SetWindowLongA (infoPtr->hwndSelf, 0, 0);
+    SetWindowLongPtrW (infoPtr->hwndSelf, 0, 0);
 
     /* free rebar info data */
     Free (infoPtr);
@@ -4124,7 +4124,7 @@
 
     /* allocate memory for info structure */
     infoPtr = (REBAR_INFO *)Alloc (sizeof(REBAR_INFO));
-    SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
+    SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
 
     /* initialize info structure - initial values are 0 */
     infoPtr->clrBk = CLR_NONE;

reactos/lib/comctl32
rsrc.rc 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- rsrc.rc	8 May 2004 11:41:04 -0000	1.4
+++ rsrc.rc	19 Sep 2004 09:50:06 -0000	1.5
@@ -1106,6 +1106,84 @@
 } */
 
 
+/* BINRES idi_tt_info_sm.ico */
+IDI_TT_INFO_SM ICON LOADONCALL DISCARDABLE idi_tt_info_sm.ico
+/* {
+ '00 00 01 00 01 00 10 10 10 00 00 00 00 00 28 01'
+ '00 00 16 00 00 00 28 00 00 00 10 00 00 00 20 00'
+ '00 00 01 00 04 00 00 00 00 00 C0 00 00 00 00 00'
+ '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
+ '00 00 00 00 80 00 00 80 00 00 00 80 80 00 80 00'
+ '00 00 80 00 80 00 80 80 00 00 C0 C0 C0 00 80 80'
+ '80 00 00 00 FF 00 00 FF 00 00 00 FF FF 00 FF 00'
+ '00 00 FF 00 FF 00 FF FF 00 00 FF FF FF 00 00 00'
+ '00 00 08 80 00 00 00 00 00 08 00 80 00 00 00 00'
+ '08 80 F0 80 00 00 00 00 80 0F F0 88 00 00 00 00'
+ '0F FF FF 00 80 00 00 0F FF FF FF FF 08 00 08 FF'
+ 'FC CC CC FF F0 80 8F FF FF 8C CF FF FF 08 8F FF'
+ 'FF 8C CF FF FF 08 8F FF FF 8C CF FF FF 08 8F FF'
+ 'F8 CC CF FF FF 00 8F FF FF FF FF FF FF 00 08 FF'
+ 'FF 8C CF FF F0 00 00 8F FF CC CF FF 00 00 00 08'
+ '8F FF FF 00 00 00 00 00 08 88 88 00 00 00 FF 9F'
+ '00 00 FE 1F 00 00 F8 1F 00 00 F0 0F 00 00 E0 07'
+ '00 00 C0 03 00 00 80 01 00 00 00 00 00 00 00 00'
+ '00 00 00 00 00 00 00 01 00 00 00 01 00 00 80 03'
+ '00 00 C0 07 00 00 E0 0F 00 00 F8 3F 00 00'
+} */
+
+
+/* BINRES idi_tt_warn_sm.ico */
+IDI_TT_WARN_SM ICON LOADONCALL DISCARDABLE idi_tt_warn_sm.ico
+/* {
+ '00 00 01 00 01 00 10 10 10 00 00 00 00 00 28 01'
+ '00 00 16 00 00 00 28 00 00 00 10 00 00 00 20 00'
+ '00 00 01 00 04 00 00 00 00 00 C0 00 00 00 00 00'
+ '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
+ '00 00 00 00 80 00 00 80 00 00 00 80 80 00 80 00'
+ '00 00 80 00 80 00 80 80 00 00 C0 C0 C0 00 80 80'
+ '80 00 00 00 FF 00 00 FF 00 00 00 FF FF 00 FF 00'
+ '00 00 FF 00 FF 00 FF FF 00 00 FF FF FF 00 03 33'
+ '33 33 33 33 33 33 00 00 00 00 00 00 00 03 0B BB'
+ 'BB BB BB BB BB 03 00 BB BB 30 3B BB B0 30 00 BB'
+ 'BB 30 3B BB B0 30 00 0B BB BB BB BB 03 00 00 0B'
+ 'BB B0 BB BB 03 00 00 00 BB 30 3B B0 30 00 00 00'
+ 'BB 00 0B B0 30 00 00 00 0B 00 0B 03 00 00 00 00'
+ '0B B0 BB 03 00 00 00 00 00 BB B0 30 00 00 00 00'
+ '00 BB B0 30 00 00 00 00 00 0B 03 00 00 00 00 00'
+ '00 0B 03 00 00 00 00 00 00 00 30 00 00 00 80 00'
+ '00 00 00 00 00 00 00 00 00 00 80 01 00 00 80 01'
+ '00 00 C0 03 00 00 C0 03 00 00 E0 07 00 00 E0 07'
+ '00 00 F0 0F 00 00 F0 0F 00 00 F8 1F 00 00 F8 1F'
+ '00 00 FC 3F 00 00 FC 3F 00 00 FE 7F 00 00'
+} */
+
+
+/* BINRES idi_tt_error_sm.ico */
+IDI_TT_ERROR_SM ICON LOADONCALL DISCARDABLE idi_tt_error_sm.ico
+/* {
+ '00 00 01 00 01 00 10 10 10 00 00 00 00 00 28 01'
+ '00 00 16 00 00 00 28 00 00 00 10 00 00 00 20 00'
+ '00 00 01 00 04 00 00 00 00 00 C0 00 00 00 00 00'
+ '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
+ '00 00 00 00 80 00 00 80 00 00 00 80 80 00 80 00'
+ '00 00 80 00 80 00 80 80 00 00 C0 C0 C0 00 80 80'
+ '80 00 00 00 FF 00 00 FF 00 00 00 FF FF 00 FF 00'
+ '00 00 FF 00 FF 00 FF FF 00 00 FF FF FF 00 00 00'
+ '08 88 88 80 00 00 00 08 81 11 11 88 80 00 00 01'
+ '19 99 99 11 88 00 00 19 99 99 99 99 18 80 01 99'
+ 'F9 99 99 F9 91 80 01 9F FF 99 9F FF 91 88 19 99'
+ 'FF F9 FF F9 99 18 19 99 9F FF FF 99 99 18 19 99'
+ '99 FF F9 99 99 18 19 99 9F FF FF 99 99 10 19 99'
+ 'FF F9 FF F9 99 10 01 9F FF 99 9F FF 91 00 01 99'
+ 'F9 99 99 F9 91 00 00 19 99 99 99 99 10 00 00 01'
+ '19 99 99 11 00 00 00 00 01 11 11 00 00 00 F8 1F'
+ '00 00 E0 07 00 00 E0 03 00 00 C0 01 00 00 80 01'
+ '00 00 80 00 00 00 00 00 00 00 00 00 00 00 00 00'
+ '00 00 00 01 00 00 00 01 00 00 80 03 00 00 80 03'
+ '00 00 C0 07 00 00 E0 0F 00 00 F8 3F 00 00'
+} */
+
+
 /*
  * Everything specific to any language goes
  * in one of the specific files.
@@ -1115,6 +1193,7 @@
  */
 
 #include "comctl_Cn.rc"
+#include "comctl_Cs.rc"
 #include "comctl_De.rc"
 #include "comctl_En.rc"
 #include "comctl_Es.rc"

reactos/lib/comctl32
status.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- status.c	2 Jan 2004 19:49:45 -0000	1.5
+++ status.c	19 Sep 2004 09:50:06 -0000	1.6
@@ -91,7 +91,7 @@
 #define VERT_BORDER 2
 #define HORZ_GAP    2
 
-#define STATUSBAR_GetInfoPtr(hwnd) ((STATUSWINDOWINFO *)GetWindowLongW (hwnd, 0))
+#define STATUSBAR_GetInfoPtr(hwnd) ((STATUSWINDOWINFO *)GetWindowLongPtrW (hwnd, 0))
 
 /* prototype */
 static void
@@ -165,7 +165,7 @@
 	{
 	    DRAWITEMSTRUCT dis;
 
-	    dis.CtlID = GetWindowLongW (infoPtr->Self, GWL_ID);
+	    dis.CtlID = GetWindowLongPtrW (infoPtr->Self, GWLP_ID);
 	    dis.itemID = itemID;
 	    dis.hwndItem = infoPtr->Self;
 	    dis.hDC = hdc;
@@ -777,7 +777,7 @@
 
     /* send notification */
     nmhdr.hwndFrom = infoPtr->Self;
-    nmhdr.idFrom = GetWindowLongW (infoPtr->Self, GWL_ID);
+    nmhdr.idFrom = GetWindowLongPtrW (infoPtr->Self, GWLP_ID);
     nmhdr.code = SBN_SIMPLEMODECHANGE;
     SendMessageW (infoPtr->Notify, WM_NOTIFY, 0, (LPARAM)&nmhdr);
     InvalidateRect(infoPtr->Self, NULL, FALSE);
@@ -807,7 +807,7 @@
     if (infoPtr->hwndToolTip)
 	DestroyWindow (infoPtr->hwndToolTip);
 
-    SetWindowLongW(infoPtr->Self, 0, 0);
+    SetWindowLongPtrW(infoPtr->Self, 0, 0);
     Free (infoPtr);
     return 0;
 }
@@ -826,7 +826,7 @@
     TRACE("\n");
     infoPtr = (STATUSWINDOWINFO*)Alloc (sizeof(STATUSWINDOWINFO));
     if (!infoPtr) goto create_fail;
-    SetWindowLongW (hwnd, 0, (DWORD)infoPtr);
+    SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
 
     infoPtr->Self = hwnd;
     infoPtr->Notify = lpCreate->hwndParent;
@@ -908,13 +908,13 @@
 	    CreateWindowExW (0, TOOLTIPS_CLASSW, NULL, 0,
 			     CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
 			     CW_USEDEFAULT, hwnd, 0,
-			     (HINSTANCE)GetWindowLongW(hwnd, GWL_HINSTANCE), NULL);
+			     (HINSTANCE)GetWindowLongPtrW(hwnd, GWLP_HINSTANCE), NULL);
 
 	if (infoPtr->hwndToolTip) {
 	    NMTOOLTIPSCREATED nmttc;
 
 	    nmttc.hdr.hwndFrom = hwnd;
-	    nmttc.hdr.idFrom = GetWindowLongW (hwnd, GWL_ID);
+	    nmttc.hdr.idFrom = GetWindowLongPtrW (hwnd, GWLP_ID);
 	    nmttc.hdr.code = NM_TOOLTIPSCREATED;
 	    nmttc.hwndToolTips = infoPtr->hwndToolTip;
 
@@ -1106,7 +1106,7 @@
 
     TRACE("code %04x\n", code);
     nmhdr.hwndFrom = hwnd;
-    nmhdr.idFrom = GetWindowLongW (hwnd, GWL_ID);
+    nmhdr.idFrom = GetWindowLongPtrW (hwnd, GWLP_ID);
     nmhdr.code = code;
     SendMessageW (infoPtr->Notify, WM_NOTIFY, 0, (LPARAM)&nmhdr);
     return 0;
@@ -1270,11 +1270,11 @@
 
     ZeroMemory (&wndClass, sizeof(WNDCLASSW));
     wndClass.style         = CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW;
-    wndClass.lpfnWndProc   = (WNDPROC)StatusWindowProc;
+    wndClass.lpfnWndProc   = StatusWindowProc;
     wndClass.cbClsExtra    = 0;
     wndClass.cbWndExtra    = sizeof(STATUSWINDOWINFO *);
     wndClass.hCursor       = LoadCursorW (0, (LPWSTR)IDC_ARROW);
-    wndClass.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1);
+    wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
     wndClass.lpszClassName = STATUSCLASSNAMEW;
 
     RegisterClassW (&wndClass);

reactos/lib/comctl32
syslink.c 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- syslink.c	9 Aug 2004 15:35:58 -0000	1.1
+++ syslink.c	19 Sep 2004 09:50:06 -0000	1.2
@@ -34,6 +34,7 @@
 #include "winnls.h"
 #include "commctrl.h"
 #include "comctl32.h"
+#include "wine/unicode.h"
 #include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(progress);
@@ -375,7 +376,7 @@
                         /* Copy the tag parameters */
                         if(lpID != NULL)
                         {
-                            nc = min(lenId, lstrlenW(lpID));
+                            nc = min(lenId, strlenW(lpID));
                             nc = min(nc, MAX_LINKID_TEXT);
                             Last->u.Link.szID = SYSLINK_Alloc((MAX_LINKID_TEXT + 1) * sizeof(WCHAR));
                             if(Last->u.Link.szID != NULL)
@@ -388,7 +389,7 @@
                             Last->u.Link.szID = NULL;
                         if(lpUrl != NULL)
                         {
-                            nc = min(lenUrl, lstrlenW(lpUrl));
+                            nc = min(lenUrl, strlenW(lpUrl));
                             nc = min(nc, L_MAX_URL_LENGTH);
                             Last->u.Link.szUrl = SYSLINK_Alloc((L_MAX_URL_LENGTH + 1) * sizeof(WCHAR));
                             if(Last->u.Link.szUrl != NULL)
@@ -455,7 +456,7 @@
             /* Copy the tag parameters */
             if(lpID != NULL)
             {
-                nc = min(lenId, lstrlenW(lpID));
+                nc = min(lenId, strlenW(lpID));
                 nc = min(nc, MAX_LINKID_TEXT);
                 Last->u.Link.szID = SYSLINK_Alloc((MAX_LINKID_TEXT + 1) * sizeof(WCHAR));
                 if(Last->u.Link.szID != NULL)
@@ -468,7 +469,7 @@
                 Last->u.Link.szID = NULL;
             if(lpUrl != NULL)
             {
-                nc = min(lenUrl, lstrlenW(lpUrl));
+                nc = min(lenUrl, strlenW(lpUrl));
                 nc = min(nc, L_MAX_URL_LENGTH);
                 Last->u.Link.szUrl = SYSLINK_Alloc((L_MAX_URL_LENGTH + 1) * sizeof(WCHAR));
                 if(Last->u.Link.szUrl != NULL)
@@ -1223,7 +1224,7 @@
     NMLINK nml;
 
     nml.hdr.hwndFrom = infoPtr->Self;
-    nml.hdr.idFrom = GetWindowLongW(infoPtr->Self, GWL_ID);
+    nml.hdr.idFrom = GetWindowLongPtrW(infoPtr->Self, GWLP_ID);
     nml.hdr.code = code;
 
     nml.item.mask = 0;
@@ -1465,7 +1466,7 @@
 
     TRACE("hwnd=%p msg=%04x wparam=%x lParam=%lx\n", hwnd, message, wParam, lParam);
 
-    infoPtr = (SYSLINK_INFO *)GetWindowLongW(hwnd, 0);
+    infoPtr = (SYSLINK_INFO *)GetWindowLongPtrW(hwnd, 0);
 
     if (!infoPtr && message != WM_CREATE)
         return DefWindowProcW( hwnd, message, wParam, lParam );
@@ -1618,7 +1619,7 @@
         /* allocate memory for info struct */
         infoPtr = (SYSLINK_INFO *)SYSLINK_Alloc (sizeof(SYSLINK_INFO));
         if (!infoPtr) return -1;
-        SetWindowLongW (hwnd, 0, (DWORD)infoPtr);
+        SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
 
         /* initialize the info struct */
         infoPtr->Self = hwnd;
@@ -1639,7 +1640,7 @@
         TRACE("SysLink Ctrl destruction, hwnd=%p\n", hwnd);
         SYSLINK_ClearDoc(infoPtr);
         SYSLINK_Free (infoPtr);
-        SetWindowLongW(hwnd, 0, 0);
+        SetWindowLongPtrW(hwnd, 0, 0);
         return 0;
 
     default:

reactos/lib/comctl32
tab.c 1.9 -> 1.10
diff -u -r1.9 -r1.10
--- tab.c	8 Aug 2004 20:04:00 -0000	1.9
+++ tab.c	19 Sep 2004 09:50:06 -0000	1.10
@@ -112,7 +112,7 @@
 #define FLAT_BTN_SPACINGX       8
 #define DEFAULT_TAB_WIDTH       96
 
-#define TAB_GetInfoPtr(hwnd) ((TAB_INFO *)GetWindowLongA(hwnd,0))
+#define TAB_GetInfoPtr(hwnd) ((TAB_INFO *)GetWindowLongPtrW(hwnd,0))
 
 /******************************************************************************
  * Hot-tracking timer constants
@@ -136,10 +136,10 @@
     NMHDR nmhdr;
 
     nmhdr.hwndFrom = hwnd;
-    nmhdr.idFrom = GetWindowLongA(hwnd, GWL_ID);
+    nmhdr.idFrom = GetWindowLongPtrW(hwnd, GWLP_ID);
     nmhdr.code = code;
 
-    return (BOOL) SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,
+    return (BOOL) SendMessageW (infoPtr->hwndNotify, WM_NOTIFY,
             (WPARAM) nmhdr.idFrom, (LPARAM) &nmhdr);
 }
 
@@ -157,7 +157,7 @@
     msg.pt.x = LOWORD(GetMessagePos ());
     msg.pt.y = HIWORD(GetMessagePos ());
 
-    SendMessageA (hwndTip, TTM_RELAYEVENT, 0, (LPARAM)&msg);
+    SendMessageW (hwndTip, TTM_RELAYEVENT, 0, (LPARAM)&msg);
 }
 
 static void
@@ -514,7 +514,7 @@
   /*
    * Don't otherwise disturb normal behavior.
    */
-  return DefWindowProcA (hwnd, uMsg, wParam, lParam);
+  return DefWindowProcW (hwnd, uMsg, wParam, lParam);
 }
 
 static INT TAB_InternalHitTest (
@@ -917,7 +917,7 @@
 
      TAB_RecalcHotTrack(hwnd, NULL, NULL, NULL);
      TAB_InvalidateTabArea(hwnd, infoPtr);
-     SendMessageA(infoPtr->hwndUpDown, UDM_SETPOS, 0,
+     SendMessageW(infoPtr->hwndUpDown, UDM_SETPOS, 0,
                    MAKELONG(infoPtr->leftmostVisible, 0));
    }
 
@@ -1033,7 +1033,7 @@
       ShowWindow(infoPtr->hwndUpDown, SW_HIDE);
   }
   if (infoPtr->hwndUpDown)
-     SendMessageA(infoPtr->hwndUpDown, UDM_SETRANGE32, 0, maxRange);
+     SendMessageW(infoPtr->hwndUpDown, UDM_SETRANGE32, 0, maxRange);
 }
 
 /******************************************************************************
@@ -1051,7 +1051,7 @@
   TAB_INFO*   infoPtr = TAB_GetInfoPtr(hwnd);
   LONG        lStyle  = GetWindowLongA(hwnd, GWL_STYLE);
   TEXTMETRICA fontMetrics;
-  INT         curItem;
+  UINT        curItem;
   INT         curItemLeftPos;
   INT         curItemRowCount;
   HFONT       hFont, hOldFont;
@@ -1243,8 +1243,8 @@
   /* Arrange all tabs evenly if style says so */
    if (!(lStyle & TCS_RAGGEDRIGHT) &&  ((lStyle & TCS_MULTILINE) || (lStyle & TCS_VERTICAL)) && (infoPtr->uNumItem > 0))
    {
-      INT tabPerRow,remTab;
-      INT iRow,iItm;
+      INT tabPerRow,remTab,iRow;
+      UINT iItm;
       INT iCount=0;
 
       /*
@@ -1637,10 +1637,18 @@
     DRAWITEMSTRUCT dis;
     UINT id;
 
+    drawRect->top += 2;
+    drawRect->right -= 1;
+    if ( iItem == infoPtr->iSelected )
+    {
+        drawRect->right -= 1;
+        drawRect->left += 1;
+    }
+
     /*
      * get the control id
      */
-    id = GetWindowLongA( hwnd, GWL_ID );
+    id = (UINT)GetWindowLongPtrW( hwnd, GWLP_ID );
 
     /*
      * put together the DRAWITEMSTRUCT
@@ -1663,7 +1671,7 @@
     /*
      * send the draw message
      */
-    SendMessageA( infoPtr->hwndNotify, WM_DRAWITEM, (WPARAM)id, (LPARAM)&dis );
+    SendMessageW( infoPtr->hwndNotify, WM_DRAWITEM, (WPARAM)id, (LPARAM)&dis );
   }
   else
   {
@@ -2278,29 +2286,6 @@
   return 0;
 }
 
-static LRESULT TAB_EraseBackground(
-  HWND hwnd,
-  HDC  givenDC)
-{
-  HDC  hdc;
-  RECT clientRect;
-
-  HBRUSH brush = CreateSolidBrush(comctl32_color.clrBtnFace);
-
-  hdc = givenDC ? givenDC : GetDC(hwnd);
-
-  GetClientRect(hwnd, &clientRect);
-
-  FillRect(hdc, &clientRect, brush);
-
-  if (givenDC==0)
-    ReleaseDC(hwnd, hdc);
-
-  DeleteObject(brush);
-
-  return 0;
-}
-
 /******************************************************************************
  * TAB_EnsureSelectionVisible
  *
@@ -2333,7 +2318,7 @@
 
       if (newselected != iTargetRow)
       {
-         INT i;
+         UINT i;
          if(lStyle & TCS_VERTICAL)
          {
            for (i=0; i < infoPtr->uNumItem; i++)
@@ -2379,7 +2364,8 @@
   else
   {
      RECT r;
-     INT  width, i;
+     INT width;
+     UINT i;
 
      /* Calculate the part of the client area that is visible */
      GetClientRect(hwnd, &r);
@@ -2411,7 +2397,7 @@
   if (infoPtr->leftmostVisible != iOrigLeftmostVisible)
     TAB_RecalcHotTrack(hwnd, NULL, NULL, NULL);
 
-  SendMessageA(infoPtr->hwndUpDown, UDM_SETPOS, 0,
+  SendMessageW(infoPtr->hwndUpDown, UDM_SETPOS, 0,
                MAKELONG(infoPtr->leftmostVisible, 0));
 }
 
@@ -2494,10 +2480,6 @@
     TRACE("erase %d, rect=(%ld,%ld)-(%ld,%ld)\n",
          ps.fErase,
          ps.rcPaint.left,ps.rcPaint.top,ps.rcPaint.right,ps.rcPaint.bottom);
-
-    if (ps.fErase)
-      TAB_EraseBackground (hwnd, hdc);
-
   } else {
     hdc = (HDC)wParam;
   }
@@ -3122,12 +3104,12 @@
       NMTOOLTIPSCREATED nmttc;
 
       nmttc.hdr.hwndFrom = hwnd;
-      nmttc.hdr.idFrom = GetWindowLongA(hwnd, GWL_ID);
+      nmttc.hdr.idFrom = GetWindowLongPtrW(hwnd, GWLP_ID);
       nmttc.hdr.code = NM_TOOLTIPSCREATED;
       nmttc.hwndToolTips = infoPtr->hwndToolTip;
 
-      SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,
-		    (WPARAM)GetWindowLongA(hwnd, GWL_ID), (LPARAM)&nmttc);
+      SendMessageW (infoPtr->hwndNotify, WM_NOTIFY,
+		    (WPARAM)GetWindowLongPtrW(hwnd, GWLP_ID), (LPARAM)&nmttc);
     }
   }
 
@@ -3165,7 +3147,7 @@
 TAB_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
   TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd);
-  INT iItem;
+  UINT iItem;
 
   if (!infoPtr)
       return 0;
@@ -3218,7 +3200,7 @@
 
     TRACE("hwnd=%p msg=%x wParam=%x lParam=%lx\n", hwnd, uMsg, wParam, lParam);
     if (!TAB_GetInfoPtr(hwnd) && (uMsg != WM_CREATE))
-      return DefWindowProcA (hwnd, uMsg, wParam, lParam);
+      return DefWindowProcW (hwnd, uMsg, wParam, lParam);
 
     switch (uMsg)
     {
@@ -3344,7 +3326,7 @@
       return TAB_LButtonUp (hwnd, wParam, lParam);
 
     case WM_NOTIFY:
-      return SendMessageA(infoPtr->hwndNotify, WM_NOTIFY, wParam, lParam);
+      return SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, wParam, lParam);
 
     case WM_RBUTTONDOWN:
       return TAB_RButtonDown (hwnd, wParam, lParam);
@@ -3352,9 +3334,6 @@
     case WM_MOUSEMOVE:
       return TAB_MouseMove (hwnd, wParam, lParam);
 
-    case WM_ERASEBKGND:
-      return TAB_EraseBackground (hwnd, (HDC)wParam);
-
     case WM_PAINT:
       return TAB_Paint (hwnd, wParam);
 
@@ -3389,7 +3368,7 @@
       if ((uMsg >= WM_USER) && (uMsg < WM_APP))
 	WARN("unknown msg %04x wp=%08x lp=%08lx\n",
 	     uMsg, wParam, lParam);
-      return DefWindowProcA(hwnd, uMsg, wParam, lParam);
+      return DefWindowProcW(hwnd, uMsg, wParam, lParam);
     }
 
     return 0;
@@ -3399,23 +3378,23 @@
 VOID
 TAB_Register (void)
 {
-  WNDCLASSA wndClass;
+  WNDCLASSW wndClass;
 
-  ZeroMemory (&wndClass, sizeof(WNDCLASSA));
+  ZeroMemory (&wndClass, sizeof(WNDCLASSW));
   wndClass.style         = CS_GLOBALCLASS | CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;
-  wndClass.lpfnWndProc   = (WNDPROC)TAB_WindowProc;
+  wndClass.lpfnWndProc   = TAB_WindowProc;
   wndClass.cbClsExtra    = 0;
   wndClass.cbWndExtra    = sizeof(TAB_INFO *);
-  wndClass.hCursor       = LoadCursorA (0, (LPSTR)IDC_ARROW);
-  wndClass.hbrBackground = NULL;
-  wndClass.lpszClassName = WC_TABCONTROLA;
+  wndClass.hCursor       = LoadCursorW (0, (LPWSTR)IDC_ARROW);
+  wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE+1);
+  wndClass.lpszClassName = WC_TABCONTROLW;
 
-  RegisterClassA (&wndClass);
+  RegisterClassW (&wndClass);
 }
 
 
 VOID
 TAB_Unregister (void)
 {
-    UnregisterClassA (WC_TABCONTROLA, NULL);
+    UnregisterClassW (WC_TABCONTROLW, NULL);
 }

reactos/lib/comctl32
toolbar.c 1.18 -> 1.19
diff -u -r1.18 -r1.19
--- toolbar.c	14 Aug 2004 19:12:35 -0000	1.18
+++ toolbar.c	19 Sep 2004 09:50:06 -0000	1.19
@@ -42,12 +42,9 @@
  *     - TBSTYLE_REGISTERDROP
  *     - TBSTYLE_EX_DOUBLEBUFFER
  *   - Messages:
- *     - TB_GETINSERTMARK
- *     - TB_GETINSERTMARKCOLOR
  *     - TB_GETMETRICS
  *     - TB_GETOBJECT
  *     - TB_INSERTMARKHITTEST
- *     - TB_SETINSERTMARK
  *     - TB_SETMETRICS
  *   - Notifications:
  *     - NM_CHAR
@@ -58,11 +55,6 @@
  *   - Button wrapping (under construction).
  *   - Fix TB_SETROWS.
  *   - iListGap custom draw support.
- *   - Customization dialog:
- *      - Minor buglet in 'available buttons' list:
- *        Buttons are not listed in MS-like order. MS seems to use a single
- *        internal list to store the button information of both listboxes.
- *      - Drag list support.
  *
  * Testing:
  *   - Run tests using Waite Group Windows95 API Bible Volume 2.
@@ -126,6 +118,7 @@
     INT      nHeight;        /* height of the toolbar */
     INT      nWidth;         /* width of the toolbar */
     RECT     client_rect;
+    RECT     rcBound;         /* bounding rectangle */
     INT      nButtonHeight;
     INT      nButtonWidth;
     INT      nBitmapHeight;
@@ -139,8 +132,6 @@
     INT      nNumBitmaps;     /* number of bitmaps */
     INT      nNumStrings;     /* number of strings */
     INT      nNumBitmapInfos;
-    BOOL     bUnicode;        /* ASCII (FALSE) or Unicode (TRUE)? */
-    BOOL     bCaptured;       /* mouse captured? */
     INT      nButtonDown;     /* toolbar button being pressed or -1 if none */
     INT      nButtonDrag;     /* toolbar button being dragged or -1 if none */
     INT      nOldHit;
@@ -168,6 +159,8 @@
     BOOL     bNtfUnicode;     /* TRUE if NOTIFYs use {W} */
     BOOL     bDoRedraw;       /* Redraw status */
     BOOL     bDragOutSent;    /* has TBN_DRAGOUT notification been sent for this drag? */
+    BOOL     bUnicode;        /* ASCII (FALSE) or Unicode (TRUE)? */
+    BOOL     bCaptured;       /* mouse captured? */
     DWORD      dwStyle;         /* regular toolbar style */
     DWORD      dwExStyle;       /* extended toolbar style */
     DWORD      dwDTFlags;       /* DrawText flags */
@@ -175,10 +168,10 @@
     COLORREF   clrInsertMark;   /* insert mark color */
     COLORREF   clrBtnHighlight; /* color for Flat Separator */
     COLORREF   clrBtnShadow;    /* color for Flag Separator */
-    RECT     rcBound;         /* bounding rectangle */
     INT      iVersion;
     LPWSTR   pszTooltipText;    /* temporary store for a string > 80 characters
                                  * for TTN_GETDISPINFOW notification */
+    TBINSERTMARK  tbim;         /* info on insertion mark */
     TBUTTON_INFO *buttons;      /* pointer to button array */
     LPWSTR       *strings;      /* pointer to string array */
     TBITMAP_INFO *bitmaps;
@@ -212,6 +205,7 @@
 #define BOTTOM_BORDER      2
 #define DDARROW_WIDTH      11
 #define ARROW_HEIGHT       3
+#define INSERTMARK_WIDTH   2
 
 /* gap between border of button and text/image */
 #define OFFSET_X 1
@@ -219,6 +213,8 @@
 /* how wide to treat the bitmap if it isn't present */
 #define LIST_IMAGE_ABSENT_WIDTH 2
 
+#define TOOLBAR_NOWHERE (-1)
+
 #define TOOLBAR_GetInfoPtr(hwnd) ((TOOLBAR_INFO *)GetWindowLongPtrW(hwnd,0))
 #define TOOLBAR_HasText(x, y) (TOOLBAR_GetText(x, y) ? TRUE : FALSE)
 #define TOOLBAR_HasDropDownArrows(exStyle) ((exStyle & TBSTYLE_EX_DRAWDDARROWS) ? TRUE : FALSE)
@@ -247,6 +243,7 @@
 static VOID TOOLBAR_DeleteImageList(PIMLENTRY **pies, INT *cies);
 static HIMAGELIST TOOLBAR_InsertImageList(PIMLENTRY **pies, INT *cies, HIMAGELIST himl, INT id);
 static LRESULT TOOLBAR_LButtonDown(HWND hwnd, WPARAM wParam, LPARAM lParam);
+static void TOOLBAR_SetHotItemEx (TOOLBAR_INFO *infoPtr, INT nHit, DWORD dwReason);
 
 static LRESULT
 TOOLBAR_NotifyFormat(TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam);
@@ -890,7 +887,7 @@
         rcText.left += GetSystemMetrics(SM_CXEDGE) + OFFSET_X;
         rcText.right -= GetSystemMetrics(SM_CXEDGE) + OFFSET_X;
         if (GETDEFIMAGELIST(infoPtr, GETHIMLID(infoPtr,btnPtr->iBitmap)) &&
-                TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap))
+            TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap))
         {
             if (dwStyle & TBSTYLE_LIST)
                 rcText.left += infoPtr->nBitmapWidth + TOOLBAR_GetListTextOffset(infoPtr, infoPtr->iListGap);
@@ -901,8 +898,9 @@
             if (dwStyle & TBSTYLE_LIST)
                 rcText.left += LIST_IMAGE_ABSENT_WIDTH + TOOLBAR_GetListTextOffset(infoPtr, infoPtr->iListGap);
 
-        if (btnPtr->fsState & (TBSTATE_PRESSED | TBSTATE_CHECKED))
-            OffsetRect (&rcText, 1, 1);
+        if (!(infoPtr->dwItemCDFlag & TBCDRF_NOOFFSET) &&
+          (btnPtr->fsState & (TBSTATE_PRESSED | TBSTATE_CHECKED)))
+            OffsetRect(&rcText, 1, 1);
     }
 
     /* Initialize fields in all cases, because we use these later
@@ -1095,6 +1093,20 @@
             TOOLBAR_DrawButton (hwnd, btnPtr, hdc);
     }
 
+    /* draw insert mark if required */
+    if (infoPtr->tbim.iButton != -1)
+    {
+        RECT rcButton = infoPtr->buttons[infoPtr->tbim.iButton].rect;
+        RECT rcInsertMark;
+        rcInsertMark.top = rcButton.top;
+        rcInsertMark.bottom = rcButton.bottom;
+        if (infoPtr->tbim.dwFlags & TBIMHT_AFTER)
+            rcInsertMark.left = rcInsertMark.right = rcButton.right;
+        else
+            rcInsertMark.left = rcInsertMark.right = rcButton.left - INSERTMARK_WIDTH;
+        COMCTL32_DrawInsertMark(hdc, &rcInsertMark, infoPtr->clrInsertMark, FALSE);
+    }
+
     if (infoPtr->bBtnTranspnt && (oldBKmode != TRANSPARENT))
 	SetBkMode (hdc, oldBKmode);
 
@@ -1661,7 +1673,7 @@
     }
 
     TRACE(" NOWHERE!\n");
-    return -1;
+    return TOOLBAR_NOWHERE;
 }
 
 
@@ -1751,6 +1763,290 @@
     SendMessageA (hwndTip, TTM_RELAYEVENT, 0, (LPARAM)&msg);
 }
 
+/* keeps available button list box sorted by button id */
+static void TOOLBAR_Cust_InsertAvailButton(HWND hwnd, PCUSTOMBUTTON btnInfoNew)
+{
+    int i;
+    int count;
+    PCUSTOMBUTTON btnInfo;
+    HWND hwndAvail = GetDlgItem(hwnd, IDC_AVAILBTN_LBOX);
+
+    ERR("button %s, idCommand %d\n", debugstr_w(btnInfoNew->text), btnInfoNew->btn.idCommand);
+
+    count = SendMessageA(hwndAvail, LB_GETCOUNT, 0, 0);
+
+    /* position 0 is always separator */
+    for (i = 1; i < count; i++)
+    {
+        btnInfo = (PCUSTOMBUTTON)SendMessageA(hwndAvail, LB_GETITEMDATA, i, 0);
+        if (btnInfoNew->btn.idCommand < btnInfo->btn.idCommand)
+        {
+            i = SendMessageA(hwndAvail, LB_INSERTSTRING, i, 0);
+            SendMessageA(hwndAvail, LB_SETITEMDATA, i, (LPARAM)btnInfoNew);
+            return;
+        }
+    }
+    /* id higher than all others add to end */
+    i = SendMessageA(hwndAvail, LB_ADDSTRING, 0, 0);
+    SendMessageA(hwndAvail, LB_SETITEMDATA, i, (LPARAM)btnInfoNew);
+}
+
+static void TOOLBAR_Cust_MoveButton(PCUSTDLG_INFO custInfo, HWND hwnd, INT nIndexFrom, INT nIndexTo)
+{
+    NMTOOLBARA nmtb;
+
+	TRACE("index from %d, index to %d\n", nIndexFrom, nIndexTo);
+
+    if (nIndexFrom == nIndexTo)
+        return;
+
+    /* send TBN_QUERYINSERT notification */
+    nmtb.iItem = nIndexFrom; /* FIXME: this doesn't look right */
+    if (TOOLBAR_SendNotify((NMHDR *)&nmtb, custInfo->tbInfo, TBN_QUERYINSERT))
+    {
+        PCUSTOMBUTTON btnInfo;
+        NMHDR hdr;
+        HWND hwndList = GetDlgItem(hwnd, IDC_TOOLBARBTN_LBOX);
+        int count = SendMessageA(hwndList, LB_GETCOUNT, 0, 0);
+
+        btnInfo = (PCUSTOMBUTTON)SendMessageA(hwndList, LB_GETITEMDATA, nIndexFrom, 0);
+
+        SendMessageA(hwndList, LB_DELETESTRING, nIndexFrom, 0);
+        SendMessageA(hwndList, LB_INSERTSTRING, nIndexTo, 0);
+        SendMessageA(hwndList, LB_SETITEMDATA, nIndexTo, (LPARAM)btnInfo);
+        SendMessageA(hwndList, LB_SETCURSEL, nIndexTo, 0);
+
+        if (nIndexTo <= 0)
+            EnableWindow(GetDlgItem(hwnd,IDC_MOVEUP_BTN), FALSE);
+        else
+            EnableWindow(GetDlgItem(hwnd,IDC_MOVEUP_BTN), TRUE);
+
+        /* last item is always separator, so -2 instead of -1 */
+        if (nIndexTo >= (count - 2))
+            EnableWindow(GetDlgItem(hwnd,IDC_MOVEDN_BTN), FALSE);
+        else
+            EnableWindow(GetDlgItem(hwnd,IDC_MOVEDN_BTN), TRUE);
+
+        SendMessageA(custInfo->tbHwnd, TB_DELETEBUTTON, nIndexFrom, 0);
+        SendMessageA(custInfo->tbHwnd, TB_INSERTBUTTONA, nIndexTo, (LPARAM)&(btnInfo->btn));
+
+        TOOLBAR_SendNotify(&hdr, custInfo->tbInfo, TBN_TOOLBARCHANGE);
+    }
+}
+
+static void TOOLBAR_Cust_AddButton(PCUSTDLG_INFO custInfo, HWND hwnd, INT nIndexAvail, INT nIndexTo)
+{
+    NMTOOLBARA nmtb;
+
+    TRACE("Add: nIndexAvail %d, nIndexTo %d\n", nIndexAvail, nIndexTo);
+
+    /* send TBN_QUERYINSERT notification */
+    nmtb.iItem = nIndexAvail; /* FIXME: this doesn't look right */
+    if (TOOLBAR_SendNotify((NMHDR *)&nmtb, custInfo->tbInfo, TBN_QUERYINSERT))
+    {
+        PCUSTOMBUTTON btnInfo;
+        NMHDR hdr;
+        HWND hwndList = GetDlgItem(hwnd, IDC_TOOLBARBTN_LBOX);
+        HWND hwndAvail = GetDlgItem(hwnd, IDC_AVAILBTN_LBOX);
+        int count = SendMessageA(hwndAvail, LB_GETCOUNT, 0, 0);
+
+        btnInfo = (PCUSTOMBUTTON)SendMessageA(hwndAvail, LB_GETITEMDATA, nIndexAvail, 0);
+
+        if (nIndexAvail != 0) /* index == 0 indicates separator */
+        {
+            /* remove from 'available buttons' list */
+            SendMessageA(hwndAvail, LB_DELETESTRING, nIndexAvail, 0);
+            if (nIndexAvail == count-1)
+                SendMessageA(hwndAvail, LB_SETCURSEL, nIndexAvail-1 , 0);
+            else
+                SendMessageA(hwndAvail, LB_SETCURSEL, nIndexAvail , 0);
+        }
+        else
+        {
+            PCUSTOMBUTTON btnNew;
+
+            /* duplicate 'separator' button */
+            btnNew = (PCUSTOMBUTTON)Alloc(sizeof(CUSTOMBUTTON));
+            memcpy(btnNew, btnInfo, sizeof(CUSTOMBUTTON));
+            btnInfo = btnNew;
+        }
+
+        /* insert into 'toolbar button' list */
+        SendMessageA(hwndList, LB_INSERTSTRING, nIndexTo, 0);
+        SendMessageA(hwndList, LB_SETITEMDATA, nIndexTo, (LPARAM)btnInfo);
+
+        SendMessageA(custInfo->tbHwnd, TB_INSERTBUTTONA, nIndexTo, (LPARAM)&(btnInfo->btn));
+
+        TOOLBAR_SendNotify(&hdr, custInfo->tbInfo, TBN_TOOLBARCHANGE);
+    }
+}
+
+static void TOOLBAR_Cust_RemoveButton(PCUSTDLG_INFO custInfo, HWND hwnd, INT index)
+{
+    PCUSTOMBUTTON btnInfo;
+    HWND hwndList = GetDlgItem(hwnd, IDC_TOOLBARBTN_LBOX);
+
+    TRACE("Remove: index %d\n", index);
+
+    btnInfo = (PCUSTOMBUTTON)SendMessageA(hwndList, LB_GETITEMDATA, index, 0);
+
+    /* send TBN_QUERYDELETE notification */
+    if (TOOLBAR_IsButtonRemovable(custInfo->tbInfo, index, btnInfo))
+    {
+        NMHDR hdr;
+
+        SendMessageA(hwndList, LB_DELETESTRING, index, 0);
+        SendMessageA(hwndList, LB_SETCURSEL, index , 0);
+
+        SendMessageA(custInfo->tbHwnd, TB_DELETEBUTTON, index, 0);
+
+        /* insert into 'available button' list */
+        if (!(btnInfo->btn.fsStyle & BTNS_SEP))
+            TOOLBAR_Cust_InsertAvailButton(hwnd, btnInfo);
+        else
+            Free(btnInfo);
+
+        TOOLBAR_SendNotify(&hdr, custInfo->tbInfo, TBN_TOOLBARCHANGE);
+    }
+}
+
+/* drag list notification function for toolbar buttons list box */
+static LRESULT TOOLBAR_Cust_ToolbarDragListNotification(PCUSTDLG_INFO custInfo, HWND hwnd, DRAGLISTINFO *pDLI)
+{
+    HWND hwndList = GetDlgItem(hwnd, IDC_TOOLBARBTN_LBOX);
+    switch (pDLI->uNotification)
+    {
+    case DL_BEGINDRAG:
+    {
+        INT nCurrentItem = LBItemFromPt(hwndList, pDLI->ptCursor, TRUE);
+        INT nCount = SendMessageA(hwndList, LB_GETCOUNT, 0, 0);
+        /* no dragging for last item (separator) */
+        if (nCurrentItem >= (nCount - 1)) return FALSE;
+        return TRUE;
+    }
+    case DL_DRAGGING:
+    {
+        INT nCurrentItem = LBItemFromPt(hwndList, pDLI->ptCursor, TRUE);
+        INT nCount = SendMessageA(hwndList, LB_GETCOUNT, 0, 0);
+        /* no dragging past last item (separator) */
+        if ((nCurrentItem >= 0) && (nCurrentItem < (nCount - 1)))
+        {
+            DrawInsert(hwnd, hwndList, nCurrentItem);
+            /* FIXME: native uses "move button" cursor */
+            return DL_COPYCURSOR;
+        }
+
+        /* not over toolbar buttons list */
+        if (nCurrentItem < 0)
+        {
+            POINT ptWindow = pDLI->ptCursor;
+            HWND hwndListAvail = GetDlgItem(hwnd, IDC_AVAILBTN_LBOX);
+            MapWindowPoints(NULL, hwnd, &ptWindow, 1);
+            /* over available buttons list? */
+            if (ChildWindowFromPoint(hwnd, ptWindow) == hwndListAvail)
+                /* FIXME: native uses "move button" cursor */
+                return DL_COPYCURSOR;
+        }
+        /* clear drag arrow */
+        DrawInsert(hwnd, hwndList, -1);
+        return DL_STOPCURSOR;
+    }
+    case DL_DROPPED:
+    {
+        INT nIndexTo = LBItemFromPt(hwndList, pDLI->ptCursor, TRUE);
+        INT nIndexFrom = SendMessageA(hwndList, LB_GETCURSEL, 0, 0);
+        INT nCount = SendMessageA(hwndList, LB_GETCOUNT, 0, 0);
+        if ((nIndexTo >= 0) && (nIndexTo < (nCount - 1)))
+        {
+            /* clear drag arrow */
+            DrawInsert(hwnd, hwndList, -1);
+            /* move item */
+            TOOLBAR_Cust_MoveButton(custInfo, hwnd, nIndexFrom, nIndexTo);
+        }
+        /* not over toolbar buttons list */
+        if (nIndexTo < 0)
+        {
+            POINT ptWindow = pDLI->ptCursor;
+            HWND hwndListAvail = GetDlgItem(hwnd, IDC_AVAILBTN_LBOX);
+            MapWindowPoints(NULL, hwnd, &ptWindow, 1);
+            /* over available buttons list? */
+            if (ChildWindowFromPoint(hwnd, ptWindow) == hwndListAvail)
+                TOOLBAR_Cust_RemoveButton(custInfo, hwnd, nIndexFrom);
+        }
+        break;
+    }
+	case DL_CANCELDRAG:
+        /* Clear drag arrow */
+        DrawInsert(hwnd, hwndList, -1);
+        break;
+    }
+
+	return 0;
+}
+
+/* drag list notification function for available buttons list box */
+static LRESULT TOOLBAR_Cust_AvailDragListNotification(PCUSTDLG_INFO custInfo, HWND hwnd, DRAGLISTINFO *pDLI)
+{
+    HWND hwndList = GetDlgItem(hwnd, IDC_TOOLBARBTN_LBOX);
+    switch (pDLI->uNotification)
+    {
+    case DL_BEGINDRAG:
+    {
+        INT nCurrentItem = LBItemFromPt(hwndList, pDLI->ptCursor, TRUE);
+        INT nCount = SendMessageA(hwndList, LB_GETCOUNT, 0, 0);
+        /* no dragging for last item (separator) */
+        if (nCurrentItem >= (nCount - 1)) return FALSE;
+        return TRUE;
+    }
+    case DL_DRAGGING:
+    {
+        INT nCurrentItem = LBItemFromPt(hwndList, pDLI->ptCursor, TRUE);
+        INT nCount = SendMessageA(hwndList, LB_GETCOUNT, 0, 0);
+        /* no dragging past last item (separator) */
+        if ((nCurrentItem >= 0) && (nCurrentItem < (nCount - 1)))
+        {
+            DrawInsert(hwnd, hwndList, nCurrentItem);
+            /* FIXME: native uses "move button" cursor */
+            return DL_COPYCURSOR;
+        }
+
+        /* not over toolbar buttons list */
+        if (nCurrentItem < 0)
+        {
+            POINT ptWindow = pDLI->ptCursor;
+            HWND hwndListAvail = GetDlgItem(hwnd, IDC_AVAILBTN_LBOX);
+            MapWindowPoints(NULL, hwnd, &ptWindow, 1);
+            /* over available buttons list? */
+            if (ChildWindowFromPoint(hwnd, ptWindow) == hwndListAvail)
+                /* FIXME: native uses "move button" cursor */
+                return DL_COPYCURSOR;
+        }
+        /* clear drag arrow */
+        DrawInsert(hwnd, hwndList, -1);
+        return DL_STOPCURSOR;
+    }
+    case DL_DROPPED:
+    {
+        INT nIndexTo = LBItemFromPt(hwndList, pDLI->ptCursor, TRUE);
+        INT nCount = SendMessageA(hwndList, LB_GETCOUNT, 0, 0);
+        INT nIndexFrom = SendDlgItemMessageA(hwnd, IDC_AVAILBTN_LBOX, LB_GETCURSEL, 0, 0);
+        if ((nIndexTo >= 0) && (nIndexTo < (nCount - 1)))
+        {
+            /* clear drag arrow */
+            DrawInsert(hwnd, hwndList, -1);
+            /* add item */
+            TOOLBAR_Cust_AddButton(custInfo, hwnd, nIndexFrom, nIndexTo);
+        }
+    }
+	case DL_CANCELDRAG:
+        /* Clear drag arrow */
+        DrawInsert(hwnd, hwndList, -1);
+        break;
+	}
+	return 0;
+}
+
+extern UINT uDragListMessage;
 
 /***********************************************************************
  * TOOLBAR_CustomizeDialogProc
@@ -1851,10 +2147,6 @@
 			btnInfo = (PCUSTOMBUTTON)Alloc(sizeof(CUSTOMBUTTON));
 			btnInfo->bVirtual = FALSE;
 			btnInfo->bRemovable = TRUE;
-
-			index = SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_ADDSTRING, 0, 0);
-			SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, 
-				LB_SETITEMDATA, index, (LPARAM)btnInfo);
 		    }
 		    else
 		    {
@@ -1874,6 +2166,9 @@
                                 infoPtr->strings[nmtb.tbButton.iString]);
                         }
 		    }
+
+		    if (index == -1)
+			TOOLBAR_Cust_InsertAvailButton(hwnd, btnInfo);
 		}
 
 		SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_SETITEMHEIGHT, 0, infoPtr->nBitmapHeight + 8);
@@ -1895,6 +2190,9 @@
 		SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETCURSEL, index, 0);
 		SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETTOPINDEX, index, 0);
 
+        MakeDragList(GetDlgItem(hwnd, IDC_TOOLBARBTN_LBOX));
+        MakeDragList(GetDlgItem(hwnd, IDC_AVAILBTN_LBOX));
+
 		/* set focus and disable buttons */
 		PostMessageA (hwnd, WM_USER, 0, 0);
 	    }
@@ -1963,117 +2261,26 @@
 
 		case IDC_MOVEUP_BTN:
 		    {
-			PCUSTOMBUTTON btnInfo;
-			int index;
-			int count;
-
-			count = SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETCOUNT, 0, 0);
-			index = SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETCURSEL, 0, 0);
-			TRACE("Move up: index %d\n", index);
-
-			/* send TBN_QUERYINSERT notification */
-			nmtb.iItem = index;
-
-		        if (TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr,
-					    TBN_QUERYINSERT))
-			{
-			    NMHDR hdr;
-
-			    btnInfo = (PCUSTOMBUTTON)SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETITEMDATA, index, 0);
-
-			    SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_DELETESTRING, index, 0);
-			    SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_INSERTSTRING, index-1, 0);
-			    SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETITEMDATA, index-1, (LPARAM)btnInfo);
-			    SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETCURSEL, index-1 , 0);
-
-			    if (index <= 1)
-				EnableWindow (GetDlgItem (hwnd,IDC_MOVEUP_BTN), FALSE);
-			    else if (index >= (count - 3))
-				EnableWindow (GetDlgItem (hwnd,IDC_MOVEDN_BTN), TRUE);
-
-			    SendMessageA (custInfo->tbHwnd, TB_DELETEBUTTON, index, 0);
-			    SendMessageA (custInfo->tbHwnd, TB_INSERTBUTTONA, index-1, (LPARAM)&(btnInfo->btn));
-
-			    TOOLBAR_SendNotify(&hdr, infoPtr, TBN_TOOLBARCHANGE);
-			}
+			int index = SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETCURSEL, 0, 0);
+			TOOLBAR_Cust_MoveButton(custInfo, hwnd, index, index-1);
 		    }
 		    break;
 
 		case IDC_MOVEDN_BTN: /* move down */
 		    {
-			PCUSTOMBUTTON btnInfo;
-			int index;
-			int count;
-
-			count = SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETCOUNT, 0, 0);
-			index = SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETCURSEL, 0, 0);
-			TRACE("Move up: index %d\n", index);
-
-			/* send TBN_QUERYINSERT notification */
-			nmtb.iItem = index;
-		        if (TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr,
-					    TBN_QUERYINSERT))
-			{
-			    NMHDR hdr;
-
-			    btnInfo = (PCUSTOMBUTTON)SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETITEMDATA, index, 0);
-
-			    /* move button down */
-			    SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_DELETESTRING, index, 0);
-			    SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_INSERTSTRING, index+1, 0);
-			    SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETITEMDATA, index+1, (LPARAM)btnInfo);
-			    SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETCURSEL, index+1 , 0);
-
-			    if (index == 0)
-				EnableWindow (GetDlgItem (hwnd,IDC_MOVEUP_BTN), TRUE);
-			    else if (index >= (count - 3))
-				EnableWindow (GetDlgItem (hwnd,IDC_MOVEDN_BTN), FALSE);
-
-			    SendMessageA (custInfo->tbHwnd, TB_DELETEBUTTON, index, 0);
-			    SendMessageA (custInfo->tbHwnd, TB_INSERTBUTTONA, index+1, (LPARAM)&(btnInfo->btn));
-
-			    TOOLBAR_SendNotify(&hdr, infoPtr, TBN_TOOLBARCHANGE);
-			}
+			int index = SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETCURSEL, 0, 0);
+			TOOLBAR_Cust_MoveButton(custInfo, hwnd, index, index+1);
 		    }
 		    break;
 
 		case IDC_REMOVE_BTN: /* remove button */
 		    {
-			PCUSTOMBUTTON btnInfo;
-			int index;
-
-			index = SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETCURSEL, 0, 0);
+			int index = SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETCURSEL, 0, 0);
 
 			if (LB_ERR == index)
 				break;
 
-			TRACE("Remove: index %d\n", index);
-
-			btnInfo = (PCUSTOMBUTTON)SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, 
-				LB_GETITEMDATA, index, 0);
-
-			/* send TBN_QUERYDELETE notification */
-			if (TOOLBAR_IsButtonRemovable(infoPtr, index, btnInfo))
-			{
-			    NMHDR hdr;
-
-			    btnInfo = (PCUSTOMBUTTON)SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETITEMDATA, index, 0);
-			    SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_DELETESTRING, index, 0);
-			    SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETCURSEL, index , 0);
-
-			    SendMessageA (custInfo->tbHwnd, TB_DELETEBUTTON, index, 0);
-
-			    /* insert into 'available button' list */
-			    if (!(btnInfo->btn.fsStyle & BTNS_SEP))
-			    {
-				index = (int)SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_ADDSTRING, 0, 0);
-				SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_SETITEMDATA, index, (LPARAM)btnInfo);
-			    }
-			    else
-				Free (btnInfo);
-
-			    TOOLBAR_SendNotify(&hdr, infoPtr, TBN_TOOLBARCHANGE);
-			}
+			TOOLBAR_Cust_RemoveButton(custInfo, hwnd, index);
 		    }
 		    break;
 		case IDC_HELP_BTN:
@@ -2086,49 +2293,12 @@
 		case IDOK: /* Add button */
 		    {
 			int index;
-			int count;
+			int indexto;
 
-			count = SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_GETCOUNT, 0, 0);
-			index = SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_GETCURSEL, 0, 0);
-			TRACE("Add: index %d\n", index);
+			index = SendDlgItemMessageA(hwnd, IDC_AVAILBTN_LBOX, LB_GETCURSEL, 0, 0);
+			indexto = SendDlgItemMessageA(hwnd, IDC_TOOLBARBTN_LBOX, LB_GETCURSEL, 0, 0);
 
-			/* send TBN_QUERYINSERT notification */
-			nmtb.iItem = index;
-		        if (TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr,
-					    TBN_QUERYINSERT))
-			{
-			    NMHDR hdr;
-
-			    btnInfo = (PCUSTOMBUTTON)SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_GETITEMDATA, index, 0);
-
-			    if (index != 0)
-			    {
-				/* remove from 'available buttons' list */
-				SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_DELETESTRING, index, 0);
-				if (index == count-1)
-				    SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_SETCURSEL, index-1 , 0);
-				else
-				    SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_SETCURSEL, index , 0);
-			    }
-			    else
-			    {
-				PCUSTOMBUTTON btnNew;
-
-				/* duplicate 'separator' button */
-				btnNew = (PCUSTOMBUTTON)Alloc (sizeof(CUSTOMBUTTON));
-				memcpy (btnNew, btnInfo, sizeof(CUSTOMBUTTON));
-				btnInfo = btnNew;
-			    }
-
-			    /* insert into 'toolbar button' list */
-			    index = SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETCURSEL, 0, 0);
-			    SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_INSERTSTRING, index, 0);
-			    SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETITEMDATA, index, (LPARAM)btnInfo);
-
-			    SendMessageA (custInfo->tbHwnd, TB_INSERTBUTTONA, index, (LPARAM)&(btnInfo->btn));
-
-			    TOOLBAR_SendNotify(&hdr, infoPtr, TBN_TOOLBARCHANGE);
-			}
+			TOOLBAR_Cust_AddButton(custInfo, hwnd, index, indexto);
 		    }
 		    break;
 
@@ -2247,7 +2417,24 @@
 	    return FALSE;
 
 	default:
-	    return FALSE;
+            if (uDragListMessage && (uMsg == uDragListMessage))
+            {
+                if (wParam == IDC_TOOLBARBTN_LBOX)
+                {
+                    LRESULT res = TOOLBAR_Cust_ToolbarDragListNotification(
+                        custInfo, hwnd, (DRAGLISTINFO *)lParam);
+                    SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, res);
+                    return TRUE;
+                }
+                else if (wParam == IDC_AVAILBTN_LBOX)
+                {
+                    LRESULT res = TOOLBAR_Cust_AvailDragListNotification(
+                        custInfo, hwnd, (DRAGLISTINFO *)lParam);
+                    SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, res);
+                    return TRUE;
+                }
+            }
+            return FALSE;
     }
 }
 
@@ -3370,8 +3557,29 @@
 }
 
 
-/* << TOOLBAR_GetInsertMark >> */
-/* << TOOLBAR_GetInsertMarkColor >> */
+static LRESULT
+TOOLBAR_GetInsertMark (HWND hwnd, WPARAM wParam, LPARAM lParam)
+{
+    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
+    TBINSERTMARK *lptbim = (TBINSERTMARK*)lParam;
+
+    TRACE("hwnd = %p, lptbim = %p\n", hwnd, lptbim);
+
+    *lptbim = infoPtr->tbim;
+
+    return 0;
+}
+
+
+static LRESULT
+TOOLBAR_GetInsertMarkColor (HWND hwnd, WPARAM wParam, LPARAM lParam)
+{
+    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
+
+    TRACE("hwnd = %p\n", hwnd);
+
+    return (LRESULT)infoPtr->clrInsertMark;
+}
 
 
 static LRESULT
@@ -3949,6 +4157,8 @@
 {
     TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     INT nIndex;
+    DWORD oldState;
+    TBUTTON_INFO *btnPtr;
 
     TRACE("hwnd = %p, wParam = %d, lParam = 0x%08lx\n", hwnd, wParam, lParam);
 
@@ -3956,10 +4166,16 @@
     if (nIndex == -1)
         return FALSE;
 
+    btnPtr = &infoPtr->buttons[nIndex];
+    oldState = btnPtr->fsState;
+
     if (LOWORD(lParam))
-        infoPtr->buttons[nIndex].fsState |= TBSTATE_MARKED;
+        btnPtr->fsState |= TBSTATE_MARKED;
     else
-        infoPtr->buttons[nIndex].fsState &= ~TBSTATE_MARKED;
+        btnPtr->fsState &= ~TBSTATE_MARKED;
+
+    if(oldState != btnPtr->fsState)
+        InvalidateRect(hwnd, &btnPtr->rect, TRUE);
 
     return TRUE;
 }
@@ -4232,8 +4448,12 @@
     TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     BOOL bOldAnchor = infoPtr->bAnchor;
 
+    TRACE("hwnd=%p, bAnchor = %s\n", hwnd, wParam ? "TRUE" : "FALSE");
+
     infoPtr->bAnchor = (BOOL)wParam;
 
+    /* Native does not remove the hot effect from an already hot button */
+
     return (LRESULT)bOldAnchor;
 }
 
@@ -4498,6 +4718,8 @@
     TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     DWORD dwTemp;
 
+    TRACE("hwnd = %p, dwMask = 0x%08lx, dwDTFlags = 0x%08lx\n", hwnd, (DWORD)wParam, (DWORD)lParam);
+
     dwTemp = infoPtr->dwDTFlags;
     infoPtr->dwDTFlags =
 	(infoPtr->dwDTFlags & (DWORD)wParam) | (DWORD)lParam;
@@ -4573,7 +4795,7 @@
         NMTBHOTITEM nmhotitem;
         TBUTTON_INFO *btnPtr = NULL, *oldBtnPtr = NULL;
         LRESULT no_highlight;
-	
+
         /* Remove the effect of an old hot button if the button was
            drawn with the hot button effect */
         if(infoPtr->nHotItem >= 0)
@@ -4617,14 +4839,19 @@
     TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr(hwnd);
     INT nOldHotItem = infoPtr->nHotItem;
 
+    TRACE("hwnd = %p, nHit = %d\n", hwnd, (INT)wParam);
+
     if ((INT) wParam < 0 || (INT)wParam > infoPtr->nNumButtons)
-        wParam = -2;
+        wParam = -1;
+
+    /* NOTE: an application can still remove the hot item even if anchor
+     * highlighting is enabled */
 
     if (infoPtr->dwStyle & TBSTYLE_FLAT)
         TOOLBAR_SetHotItemEx(infoPtr, wParam, HICF_OTHER);
 
     if (nOldHotItem < 0)
-	return -1;
+        return -1;
 
     return (LRESULT)nOldHotItem;
 }
@@ -4681,7 +4908,33 @@
 }
 
 
-/* << TOOLBAR_SetInsertMark >> */
+static LRESULT
+TOOLBAR_SetInsertMark (HWND hwnd, WPARAM wParam, LPARAM lParam)
+{
+    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
+    TBINSERTMARK *lptbim = (TBINSERTMARK*)lParam;
+
+    TRACE("hwnd = %p, lptbim = { %d, 0x%08lx}\n", hwnd, lptbim->iButton, lptbim->dwFlags);
+
+    if ((lptbim->dwFlags & ~TBIMHT_AFTER) != 0)
+    {
+        FIXME("Unrecognized flag(s): 0x%08lx\n", (lptbim->dwFlags & ~TBIMHT_AFTER));
+        return 0;
+    }
+
+    if ((lptbim->iButton == -1) || 
+        ((lptbim->iButton < infoPtr->nNumButtons) &&
+         (lptbim->iButton >= 0)))
+    {
+        infoPtr->tbim = *lptbim;
+        /* FIXME: don't need to update entire toolbar */
+        InvalidateRect(hwnd, NULL, TRUE);
+    }
+    else
+        ERR("Invalid button index %d\n", lptbim->iButton);
+
+    return 0;
+}
 
 
 static LRESULT
@@ -4691,7 +4944,8 @@
 
     infoPtr->clrInsertMark = (COLORREF)lParam;
 
-    /* FIXME : redraw ??*/
+    /* FIXME: don't need to update entire toolbar */
+    InvalidateRect(hwnd, NULL, TRUE);
 
     return 0;
 }
@@ -4981,6 +5235,9 @@
     if ((INT) wParam < 0 || (INT)wParam > infoPtr->nNumButtons)
         wParam = -1;
 
+    /* NOTE: an application can still remove the hot item even if anchor
+     * highlighting is enabled */
+
     TOOLBAR_SetHotItemEx(infoPtr, wParam, lParam);
 
     GetFocus();
@@ -5002,7 +5259,6 @@
     
     infoPtr->iListGap = (INT)wParam;
 
-    TOOLBAR_CalcToolbar(hwnd);
     InvalidateRect(hwnd, NULL, TRUE);
 
     return 0;
@@ -5126,6 +5382,7 @@
     infoPtr->szPadding.cy = 2*(GetSystemMetrics(SM_CYEDGE)+OFFSET_Y);
     infoPtr->iListGap = infoPtr->szPadding.cx / 2;
     infoPtr->dwStyle = dwStyle;
+    infoPtr->tbim.iButton = -1;
     GetClientRect(hwnd, &infoPtr->client_rect);
     TOOLBAR_NotifyFormat(infoPtr, (WPARAM)hwnd, (LPARAM)NF_REQUERY);
 
@@ -5214,6 +5471,10 @@
     INT ret = FALSE;
     DWORD ntfret;
 
+    /* the app has told us not to redraw the toolbar */
+    if (!infoPtr->bDoRedraw)
+        return FALSE;
+
     if (infoPtr->dwStyle & TBSTYLE_CUSTOMERASE) {
 	ZeroMemory (&tbcd, sizeof(NMTBCUSTOMDRAW));
 	tbcd.nmcd.dwDrawStage = CDDS_PREERASE;
@@ -5267,7 +5528,7 @@
 	    case CDRF_SKIPDEFAULT:
 		return TRUE;
 	    default:
-		FIXME("[%p] response %ld not handled to NM_CUSTOMDRAW (CDDS_PREERASE)\n",
+		FIXME("[%p] response %ld not handled to NM_CUSTOMDRAW (CDDS_POSTERASE)\n",
 		      hwnd, ntfret);
 	    }
     }
@@ -5311,6 +5572,7 @@
     POINT pt;
     INT   nHit;
     NMTOOLBARA nmtb;
+    NMMOUSE nmmouse;
     BOOL bDragKeyPressed;
 
     TRACE("\n");
@@ -5391,7 +5653,8 @@
                 GetCursorPos(&pt);
                 ScreenToClient(hwnd, &pt);
                 nHit = TOOLBAR_InternalHitTest(hwnd, &pt);
-                TOOLBAR_SetHotItemEx(infoPtr, nHit, HICF_MOUSE | HICF_LMOUSE);
+                if (!infoPtr->bAnchor || (nHit >= 0))
+                    TOOLBAR_SetHotItemEx(infoPtr, nHit, HICF_MOUSE | HICF_LMOUSE);
                 
                 /* remove any left mouse button down or double-click messages
                  * so that we can get a toggle effect on the button */
@@ -5431,6 +5694,23 @@
         TOOLBAR_SendNotify((NMHDR *)&nmtb, infoPtr, TBN_BEGINDRAG);
     }
 
+    nmmouse.dwHitInfo = nHit;
+
+    /* !!! Undocumented - sends NM_LDOWN with the NMMOUSE structure. */
+    if (nmmouse.dwHitInfo < 0)
+        nmmouse.dwItemSpec = -1;
+    else
+    {
+        nmmouse.dwItemSpec = infoPtr->buttons[nmmouse.dwHitInfo].idCommand;
+        nmmouse.dwItemData = infoPtr->buttons[nmmouse.dwHitInfo].dwData;
+    }
+
+    ClientToScreen(hwnd, &pt); 
+    nmmouse.pt = pt;
+
+    if (!TOOLBAR_SendNotify((LPNMHDR)&nmmouse, infoPtr, NM_LDOWN))
+        return DefWindowProcW(hwnd, WM_LBUTTONDOWN, wParam, lParam);
+
     return 0;
 }
 
@@ -5455,7 +5735,8 @@
     pt.y = (INT)HIWORD(lParam);
     nHit = TOOLBAR_InternalHitTest (hwnd, &pt);
 
-    TOOLBAR_SetHotItemEx(infoPtr, nHit, HICF_MOUSE | HICF_LMOUSE);
+    if (!infoPtr->bAnchor || (nHit >= 0))
+        TOOLBAR_SetHotItemEx(infoPtr, nHit, HICF_MOUSE | HICF_LMOUSE);
 
     if (infoPtr->nButtonDrag >= 0) {
         RECT rcClient;
@@ -5578,16 +5859,27 @@
 	{
 	    SendMessageA (infoPtr->hwndNotify, WM_COMMAND,
 	      MAKEWPARAM(infoPtr->buttons[nHit].idCommand, 0), (LPARAM)hwnd);
+        }
+    }
 
-	    /* !!! Undocumented - toolbar at 4.71 level and above sends
-	    * either NM_RCLICK or NM_CLICK with the NMMOUSE structure.
-	    * Only NM_RCLICK is documented.
-	    */
-	    nmmouse.dwItemSpec = btnPtr->idCommand;
-	    nmmouse.dwItemData = btnPtr->dwData;
-	    TOOLBAR_SendNotify ((NMHDR *) &nmmouse, infoPtr, NM_CLICK);
-	}
+    /* !!! Undocumented - toolbar at 4.71 level and above sends
+    * NM_CLICK with the NMMOUSE structure. */
+    nmmouse.dwHitInfo = nHit;
+
+    if (nmmouse.dwHitInfo < 0)
+        nmmouse.dwItemSpec = -1;
+    else
+    {
+        nmmouse.dwItemSpec = infoPtr->buttons[nmmouse.dwHitInfo].idCommand;
+        nmmouse.dwItemData = infoPtr->buttons[nmmouse.dwHitInfo].dwData;
     }
+
+    ClientToScreen(hwnd, &pt); 
+    nmmouse.pt = pt;
+
+    if (!TOOLBAR_SendNotify((LPNMHDR)&nmmouse, infoPtr, NM_CLICK))
+        return DefWindowProcW(hwnd, WM_LBUTTONUP, wParam, lParam);
+
     return 0;
 }
 
@@ -5612,9 +5904,10 @@
     }
 
     ClientToScreen(hwnd, &pt); 
-    memcpy(&nmmouse.pt, &pt, sizeof(POINT));
+    nmmouse.pt = pt;
 
-    TOOLBAR_SendNotify((LPNMHDR)&nmmouse, infoPtr, NM_RCLICK);
+    if (!TOOLBAR_SendNotify((LPNMHDR)&nmmouse, infoPtr, NM_RCLICK))
+        return DefWindowProcW(hwnd, WM_RBUTTONUP, wParam, lParam);
 
     return 0;
 }
@@ -5623,26 +5916,10 @@
 TOOLBAR_RButtonDblClk( HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
     TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
+    NMHDR nmhdr;
 
-    NMMOUSE nmmouse;
-    POINT pt;
-
-    pt.x = LOWORD(lParam);
-    pt.y = HIWORD(lParam);
-
-    nmmouse.dwHitInfo = TOOLBAR_InternalHitTest(hwnd, &pt);
-
-    if (nmmouse.dwHitInfo < 0)
-	nmmouse.dwItemSpec = -1;
-    else {
-	nmmouse.dwItemSpec = infoPtr->buttons[nmmouse.dwHitInfo].idCommand;
-	nmmouse.dwItemData = infoPtr->buttons[nmmouse.dwHitInfo].dwData;
-    }
-
-    ClientToScreen(hwnd, &pt); 
-    memcpy(&nmmouse.pt, &pt, sizeof(POINT));
-
-    TOOLBAR_SendNotify((LPNMHDR)&nmmouse, infoPtr, NM_RDBLCLK);
+    if (!TOOLBAR_SendNotify(&nmhdr, infoPtr, NM_RDBLCLK))
+        return DefWindowProcW(hwnd, WM_RBUTTONDBLCLK, wParam, lParam);
[truncated at 1000 lines; 78 more skipped]

reactos/lib/comctl32
tooltips.c 1.7 -> 1.8
diff -u -r1.7 -r1.8
--- tooltips.c	14 Aug 2004 19:12:35 -0000	1.7
+++ tooltips.c	19 Sep 2004 09:50:06 -0000	1.8
@@ -2,6 +2,7 @@
  * Tool tip control
  *
  * Copyright 1998, 1999 Eric Kohl
+ * Copyright 2004 Robert Shearman
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -17,10 +18,26 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
+ * This code was audited for completeness against the documented features
+ * of Comctl32.dll version 6.0 on Sep. 08, 2004, by Robert Shearman.
+ * 
+ * Unless otherwise noted, we believe this code to be complete, as per
+ * the specification mentioned above.
+ * If you discover missing features or bugs please note them below.
+ * 
  * TODO:
  *   - Custom draw support.
- *   - Balloon tips.
- *   - Messages.
+ *   - Animation.
+ *   - Links.
+ *   - Messages:
+ *     o TTM_ADJUSTRECT
+ *     o TTM_GETTITLEA
+ *     o TTM_GETTTILEW
+ *     o TTM_POPUP
+ *   - Styles:
+ *     o TTS_NOANIMATE
+ *     o TTS_NOFADE
+ *     o TTS_CLOSE
  *
  * Testing:
  *   - Run tests using Waite Group Windows95 API Bible Volume 2.
@@ -87,6 +104,8 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(tooltips);
 
+static HICON hTooltipIcons[TTI_ERROR+1];
+
 typedef struct
 {
     UINT      uFlags;
@@ -109,6 +128,7 @@
     COLORREF   clrBk;
     COLORREF   clrText;
     HFONT    hFont;
+    HFONT    hTitleFont;
     INT      xTrackPos;
     INT      yTrackPos;
     INT      nMaxTipWidth;
@@ -120,6 +140,8 @@
     INT      nInitialTime;
     RECT     rcMargin;
     BOOL     bToolBelow;
+    LPWSTR   pszTitle;
+    HICON    hTitleIcon;
 
     TTTOOL_INFO *tools;
 } TOOLTIPS_INFO;
@@ -129,7 +151,7 @@
 #define ID_TIMERLEAVE  3    /* tool leave timer */
 
 
-#define TOOLTIPS_GetInfoPtr(hWindow) ((TOOLTIPS_INFO *)GetWindowLongA (hWindow, 0))
+#define TOOLTIPS_GetInfoPtr(hWindow) ((TOOLTIPS_INFO *)GetWindowLongPtrW (hWindow, 0))
 
 /* offsets from window edge to start of text */
 #define NORMAL_TEXT_MARGIN 2
@@ -141,11 +163,44 @@
 #define BALLOON_STEMWIDTH 10
 #define BALLOON_STEMINDENT 20
 
-LRESULT CALLBACK
+#define BALLOON_ICON_TITLE_SPACING 8 /* horizontal spacing between icon and title */
+#define BALLOON_TITLE_TEXT_SPACING 8 /* vertical spacing between icon/title and main text */
+#define ICON_HEIGHT 16
+#define ICON_WIDTH  16
+
+static LRESULT CALLBACK
 TOOLTIPS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uId, DWORD_PTR dwRef);
 
 
-static VOID
+inline static UINT_PTR
+TOOLTIPS_GetTitleIconIndex(HICON hIcon)
+{
+    UINT i;
+    for (i = 0; i <= TTI_ERROR; i++)
+        if (hTooltipIcons[i] == hIcon)
+            return i;
+    return (UINT_PTR)hIcon;
+}
+
+static void
+TOOLTIPS_InitSystemSettings (TOOLTIPS_INFO *infoPtr)
+{
+    NONCLIENTMETRICSW nclm;
+
+    infoPtr->clrBk   = GetSysColor (COLOR_INFOBK);
+    infoPtr->clrText = GetSysColor (COLOR_INFOTEXT);
+
+    DeleteObject (infoPtr->hFont);
+    nclm.cbSize = sizeof(nclm);
+    SystemParametersInfoW (SPI_GETNONCLIENTMETRICS, 0, &nclm, 0);
+    infoPtr->hFont = CreateFontIndirectW (&nclm.lfStatusFont);
+
+    DeleteObject (infoPtr->hTitleFont);
+    nclm.lfStatusFont.lfWeight = FW_BOLD;
+    infoPtr->hTitleFont = CreateFontIndirectW (&nclm.lfStatusFont);
+}
+
+static void
 TOOLTIPS_Refresh (HWND hwnd, HDC hdc)
 {
     TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr(hwnd);
@@ -165,6 +220,9 @@
 
     hBrush = CreateSolidBrush(infoPtr->clrBk);
 
+    oldBkMode = SetBkMode (hdc, TRANSPARENT);
+    SetTextColor (hdc, infoPtr->clrText);
+
     if (dwStyle & TTS_BALLOON)
     {
         /* create a region to store result into */
@@ -176,21 +234,48 @@
         FillRgn(hdc, hRgn, hBrush);
         DeleteObject(hBrush);
         hBrush = NULL;
+    }
+    else
+    {
+        /* fill the background */
+        FillRect(hdc, &rc, hBrush);
+        DeleteObject(hBrush);
+        hBrush = NULL;
+    }
 
+    if ((dwStyle & TTS_BALLOON) || infoPtr->pszTitle)
+    {
         /* calculate text rectangle */
         rc.left   += (BALLOON_TEXT_MARGIN + infoPtr->rcMargin.left);
         rc.top    += (BALLOON_TEXT_MARGIN + infoPtr->rcMargin.top);
         rc.right  -= (BALLOON_TEXT_MARGIN + infoPtr->rcMargin.right);
         rc.bottom -= (BALLOON_TEXT_MARGIN + infoPtr->rcMargin.bottom);
         if(infoPtr->bToolBelow) rc.top += BALLOON_STEMHEIGHT;
+
+        if (infoPtr->pszTitle)
+        {
+            RECT rcTitle = {rc.left, rc.top, rc.right, rc.bottom};
+            int height;
+            BOOL icon_present;
+
+            /* draw icon */
+            icon_present = infoPtr->hTitleIcon && 
+                DrawIconEx(hdc, rc.left, rc.top, infoPtr->hTitleIcon,
+                           ICON_WIDTH, ICON_HEIGHT, 0, NULL, DI_NORMAL);
+            if (icon_present)
+                rcTitle.left += ICON_WIDTH + BALLOON_ICON_TITLE_SPACING;
+
+            rcTitle.bottom = rc.top + ICON_HEIGHT;
+
+            /* draw title text */
+            hOldFont = SelectObject (hdc, infoPtr->hTitleFont);
+            height = DrawTextW(hdc, infoPtr->pszTitle, -1, &rcTitle, DT_BOTTOM | DT_SINGLELINE | DT_NOPREFIX);
+            SelectObject (hdc, hOldFont);
+            rc.top += height + BALLOON_TITLE_TEXT_SPACING;
+        }
     }
     else
     {
-        /* fill the background */
-        FillRect(hdc, &rc, hBrush);
-        DeleteObject(hBrush);
-        hBrush = NULL;
-
         /* calculate text rectangle */
         rc.left   += (NORMAL_TEXT_MARGIN + infoPtr->rcMargin.left);
         rc.top    += (NORMAL_TEXT_MARGIN + infoPtr->rcMargin.top);
@@ -198,12 +283,8 @@
         rc.bottom -= (NORMAL_TEXT_MARGIN + infoPtr->rcMargin.bottom);
     }
 
-    /* already drawn the background; don't need to draw it again
-     * when drawing text */
-    oldBkMode = SetBkMode (hdc, TRANSPARENT);
-    SetTextColor (hdc, infoPtr->clrText);
-    hOldFont = SelectObject (hdc, infoPtr->hFont);
     /* draw text */
+    hOldFont = SelectObject (hdc, infoPtr->hFont);
     DrawTextW (hdc, infoPtr->szTipText, -1, &rc, uFlags);
     /* be polite and reset the things we changed in the dc */
     SelectObject (hdc, hOldFont);
@@ -318,12 +399,12 @@
     }
 }
 
-static VOID
+static void
 TOOLTIPS_GetTipText (HWND hwnd, TOOLTIPS_INFO *infoPtr, INT nTool)
 {
     TTTOOL_INFO *toolPtr = &infoPtr->tools[nTool];
 
-    if (HIWORD((UINT)toolPtr->lpszText) == 0) {
+    if (HIWORD((UINT)toolPtr->lpszText) == 0 && toolPtr->hinst) {
 	/* load a resource */
 	TRACE("load res string %p %x\n",
 	       toolPtr->hinst, (int)toolPtr->lpszText);
@@ -351,7 +432,7 @@
 }
 
 
-static VOID
+static void
 TOOLTIPS_CalcTipSize (HWND hwnd, TOOLTIPS_INFO *infoPtr, LPSIZE lpSize)
 {
     HDC hdc;
@@ -359,6 +440,7 @@
     DWORD style = GetWindowLongW(hwnd, GWL_STYLE);
     UINT uFlags = DT_EXTERNALLEADING | DT_CALCRECT;
     RECT rc = {0, 0, 0, 0};
+    SIZE title = {0, 0};
 
     if (infoPtr->nMaxTipWidth > -1) {
 	rc.right = infoPtr->nMaxTipWidth;
@@ -369,16 +451,32 @@
     TRACE("%s\n", debugstr_w(infoPtr->szTipText));
 
     hdc = GetDC (hwnd);
+    if (infoPtr->pszTitle)
+    {
+        RECT rcTitle = {0, 0, 0, 0};
+        TRACE("title %s\n", debugstr_w(infoPtr->pszTitle));
+        if (infoPtr->hTitleIcon)
+        {
+            title.cx = ICON_WIDTH;
+            title.cy = ICON_HEIGHT;
+        }
+        if (title.cx != 0) title.cx += BALLOON_ICON_TITLE_SPACING;
+        hOldFont = SelectObject (hdc, infoPtr->hTitleFont);
+        DrawTextW(hdc, infoPtr->pszTitle, -1, &rcTitle, DT_SINGLELINE | DT_NOPREFIX | DT_CALCRECT);
+        SelectObject (hdc, hOldFont);
+        title.cy = max(title.cy, rcTitle.bottom - rcTitle.top) + BALLOON_TITLE_TEXT_SPACING;
+        title.cx += (rcTitle.right - rcTitle.left);
+    }
     hOldFont = SelectObject (hdc, infoPtr->hFont);
     DrawTextW (hdc, infoPtr->szTipText, -1, &rc, uFlags);
     SelectObject (hdc, hOldFont);
     ReleaseDC (hwnd, hdc);
 
-    if (style & TTS_BALLOON)
+    if ((style & TTS_BALLOON) || infoPtr->pszTitle)
     {
-        lpSize->cx = rc.right - rc.left + 2*BALLOON_TEXT_MARGIN +
+        lpSize->cx = max(rc.right - rc.left, title.cx) + 2*BALLOON_TEXT_MARGIN +
                        infoPtr->rcMargin.left + infoPtr->rcMargin.right;
-        lpSize->cy = rc.bottom - rc.top + 2*BALLOON_TEXT_MARGIN +
+        lpSize->cy = title.cy + rc.bottom - rc.top + 2*BALLOON_TEXT_MARGIN +
                        infoPtr->rcMargin.bottom + infoPtr->rcMargin.top +
                        BALLOON_STEMHEIGHT;
     }
@@ -392,7 +490,7 @@
 }
 
 
-static VOID
+static void
 TOOLTIPS_Show (HWND hwnd, TOOLTIPS_INFO *infoPtr)
 {
     TTTOOL_INFO *toolPtr;
@@ -583,7 +681,7 @@
 }
 
 
-static VOID
+static void
 TOOLTIPS_Hide (HWND hwnd, TOOLTIPS_INFO *infoPtr)
 {
     TTTOOL_INFO *toolPtr;
@@ -610,7 +708,7 @@
 }
 
 
-static VOID
+static void
 TOOLTIPS_TrackShow (HWND hwnd, TOOLTIPS_INFO *infoPtr)
 {
     TTTOOL_INFO *toolPtr;
@@ -708,7 +806,7 @@
 }
 
 
-static VOID
+static void
 TOOLTIPS_TrackHide (HWND hwnd, TOOLTIPS_INFO *infoPtr)
 {
     TTTOOL_INFO *toolPtr;
@@ -1056,7 +1154,8 @@
 }
 
 
-static void TOOLTIPS_DelToolCommon (HWND hwnd, TOOLTIPS_INFO *infoPtr, INT nTool)
+static void
+TOOLTIPS_DelToolCommon (HWND hwnd, TOOLTIPS_INFO *infoPtr, INT nTool)
 {
     TTTOOL_INFO *toolPtr;
 
@@ -1720,6 +1819,10 @@
 	        KillTimer(hwnd, ID_TIMERPOP);
 		SetTimer(hwnd, ID_TIMERPOP, infoPtr->nAutoPopTime, 0);
 		TRACE("timer 2 restarted\n");
+	    } else if(infoPtr->nTool != -1 && infoPtr->bActive) {
+                /* previous show attempt didn't result in tooltip so try again */
+		SetTimer(hwnd, ID_TIMERSHOW, infoPtr->nInitialTime, 0);
+		TRACE("timer 1 started!\n");
 	    }
 	    break;
     }
@@ -1820,6 +1923,56 @@
 
 
 static LRESULT
+TOOLTIPS_SetTitleA (HWND hwnd, WPARAM wParam, LPARAM lParam)
+{
+    TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
+    LPCSTR pszTitle = (LPCSTR)lParam;
+    UINT uTitleIcon = (UINT)wParam;
+    UINT size;
+
+    TRACE("hwnd = %p, title = %s, icon = %p\n", hwnd, pszTitle, (void*)uTitleIcon);
+
+    size = sizeof(WCHAR)*MultiByteToWideChar(CP_ACP, 0, pszTitle, -1, NULL, 0);
+    infoPtr->pszTitle = Alloc(size);
+    if (!infoPtr->pszTitle)
+        return FALSE;
+    MultiByteToWideChar(CP_ACP, 0, pszTitle, -1, infoPtr->pszTitle, size/sizeof(WCHAR));
+    if (uTitleIcon <= TTI_ERROR)
+        infoPtr->hTitleIcon = hTooltipIcons[uTitleIcon];
+    else
+        infoPtr->hTitleIcon = CopyIcon((HICON)wParam);
+
+    return TRUE;
+}
+
+
+static LRESULT
+TOOLTIPS_SetTitleW (HWND hwnd, WPARAM wParam, LPARAM lParam)
+{
+    TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
+    LPCWSTR pszTitle = (LPCWSTR)lParam;
+    UINT uTitleIcon = (UINT)wParam;
+    UINT size;
+
+    TRACE("hwnd = %p, title = %s, icon = %p\n", hwnd, debugstr_w(pszTitle), (void*)uTitleIcon);
+
+    size = (strlenW(pszTitle)+1)*sizeof(WCHAR);
+    infoPtr->pszTitle = Alloc(size);
+    if (!infoPtr->pszTitle)
+        return FALSE;
+    memcpy(infoPtr->pszTitle, pszTitle, size);
+    if (uTitleIcon <= TTI_ERROR)
+        infoPtr->hTitleIcon = hTooltipIcons[uTitleIcon];
+    else
+        infoPtr->hTitleIcon = CopyIcon((HICON)wParam);
+
+    TRACE("icon = %p\n", infoPtr->hTitleIcon);
+
+    return TRUE;
+}
+
+
+static LRESULT
 TOOLTIPS_SetToolInfoA (HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
     TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
@@ -1907,7 +2060,7 @@
 	TRACE("set string id %x!\n", (INT)lpToolInfo->lpszText);
 	toolPtr->lpszText = lpToolInfo->lpszText;
     }
-    else if (lpToolInfo->lpszText) {
+    else {
 	if (lpToolInfo->lpszText == LPSTR_TEXTCALLBACKW)
 	    toolPtr->lpszText = LPSTR_TEXTCALLBACKW;
 	else {
@@ -1927,6 +2080,16 @@
     if (lpToolInfo->cbSize >= sizeof(TTTOOLINFOW))
 	toolPtr->lParam = lpToolInfo->lParam;
 
+    if (infoPtr->nCurrentTool == nTool)
+    {
+        TOOLTIPS_GetTipText (hwnd, infoPtr, infoPtr->nCurrentTool);
+
+        if (infoPtr->szTipText[0] == 0)
+            TOOLTIPS_Hide(hwnd, infoPtr);
+        else
+            TOOLTIPS_Show (hwnd, infoPtr);
+    }
+
     return 0;
 }
 
@@ -2120,27 +2283,23 @@
 TOOLTIPS_Create (HWND hwnd, const CREATESTRUCTW *lpcs)
 {
     TOOLTIPS_INFO *infoPtr;
-    NONCLIENTMETRICSA nclm;
 
     /* allocate memory for info structure */
     infoPtr = (TOOLTIPS_INFO *)Alloc (sizeof(TOOLTIPS_INFO));
-    SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
+    SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
 
     /* initialize info structure */
     infoPtr->bActive = TRUE;
     infoPtr->bTrackActive = FALSE;
-    infoPtr->clrBk   = GetSysColor (COLOR_INFOBK);
-    infoPtr->clrText = GetSysColor (COLOR_INFOTEXT);
-
-    nclm.cbSize = sizeof(NONCLIENTMETRICSA);
-    SystemParametersInfoA (SPI_GETNONCLIENTMETRICS, 0, &nclm, 0);
-    infoPtr->hFont = CreateFontIndirectA (&nclm.lfStatusFont);
 
     infoPtr->nMaxTipWidth = -1;
     infoPtr->nTool = -1;
     infoPtr->nCurrentTool = -1;
     infoPtr->nTrackTool = -1;
 
+    /* initialize colours and fonts */
+    TOOLTIPS_InitSystemSettings(infoPtr);
+
     TOOLTIPS_SetDelayTime(hwnd, TTDT_AUTOMATIC, 0L);
 
     SetWindowPos (hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOZORDER | SWP_HIDEWINDOW | SWP_NOACTIVATE);
@@ -2154,7 +2313,7 @@
 {
     TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
     TTTOOL_INFO *toolPtr;
-    INT i;
+    UINT i;
 
     /* free tools */
     if (infoPtr->tools) {
@@ -2182,12 +2341,19 @@
 	Free (infoPtr->tools);
     }
 
-    /* delete font */
+    /* free title string */
+    Free (infoPtr->pszTitle);
+    /* free title icon if not a standard one */
+    if (TOOLTIPS_GetTitleIconIndex(infoPtr->hTitleIcon) > TTI_ERROR)
+        DeleteObject(infoPtr->hTitleIcon);
+
+    /* delete fonts */
     DeleteObject (infoPtr->hFont);
+    DeleteObject (infoPtr->hTitleFont);
 
     /* free tool tips info data */
     Free (infoPtr);
-    SetWindowLongA(hwnd, 0, 0);
+    SetWindowLongPtrW(hwnd, 0, 0);
     return 0;
 }
 
@@ -2285,9 +2451,13 @@
     if(!GetObjectW((HFONT)wParam, sizeof(lf), &lf))
         return 0;
 
-    if(infoPtr->hFont) DeleteObject (infoPtr->hFont);
+    DeleteObject (infoPtr->hFont);
     infoPtr->hFont = CreateFontIndirectW(&lf);
 
+    DeleteObject (infoPtr->hTitleFont);
+    lf.lfWeight = FW_BOLD;
+    infoPtr->hTitleFont = CreateFontIndirectW(&lf);
+
     if ((LOWORD(lParam)) & (infoPtr->nCurrentTool != -1)) {
 	FIXME("full redraw needed!\n");
     }
@@ -2388,21 +2558,14 @@
 TOOLTIPS_WinIniChange (HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
     TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
-    NONCLIENTMETRICSA nclm;
 
-    infoPtr->clrBk   = GetSysColor (COLOR_INFOBK);
-    infoPtr->clrText = GetSysColor (COLOR_INFOTEXT);
-
-    DeleteObject (infoPtr->hFont);
-    nclm.cbSize = sizeof(NONCLIENTMETRICSA);
-    SystemParametersInfoA (SPI_GETNONCLIENTMETRICS, 0, &nclm, 0);
-    infoPtr->hFont = CreateFontIndirectA (&nclm.lfStatusFont);
+    TOOLTIPS_InitSystemSettings (infoPtr);
 
     return 0;
 }
 
 
-LRESULT CALLBACK
+static LRESULT CALLBACK
 TOOLTIPS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uID, DWORD_PTR dwRef)
 {
     MSG msg;
@@ -2530,6 +2693,12 @@
 	case TTM_SETTIPTEXTCOLOR:
 	    return TOOLTIPS_SetTipTextColor (hwnd, wParam, lParam);
 
+	case TTM_SETTITLEA:
+	    return TOOLTIPS_SetTitleA (hwnd, wParam, lParam);
+
+	case TTM_SETTITLEW:
+	    return TOOLTIPS_SetTitleW (hwnd, wParam, lParam);
+
 	case TTM_SETTOOLINFOA:
 	    return TOOLTIPS_SetToolInfoA (hwnd, wParam, lParam);
 
@@ -2568,12 +2737,11 @@
 	case WM_GETFONT:
 	    return TOOLTIPS_GetFont (hwnd, wParam, lParam);
 
-        case WM_GETTEXT:
-            return TOOLTIPS_OnWMGetText (hwnd, wParam, lParam);
-
-        case WM_GETTEXTLENGTH:
-            return TOOLTIPS_OnWMGetTextLength (hwnd, wParam, lParam);
+	case WM_GETTEXT:
+	    return TOOLTIPS_OnWMGetText (hwnd, wParam, lParam);
 
+	case WM_GETTEXTLENGTH:
+	    return TOOLTIPS_OnWMGetTextLength (hwnd, wParam, lParam);
 
 	case WM_LBUTTONDOWN:
 	case WM_LBUTTONUP:
@@ -2630,11 +2798,22 @@
     wndClass.lpszClassName = TOOLTIPS_CLASSA;
 
     RegisterClassA (&wndClass);
+
+    hTooltipIcons[TTI_NONE] = NULL;
+    hTooltipIcons[TTI_INFO] = LoadImageW(COMCTL32_hModule,
+        (LPCWSTR)MAKEINTRESOURCE(IDI_TT_INFO_SM), IMAGE_ICON, 0, 0, 0);
+    hTooltipIcons[TTI_WARNING] = LoadImageW(COMCTL32_hModule,
+        (LPCWSTR)MAKEINTRESOURCE(IDI_TT_WARN_SM), IMAGE_ICON, 0, 0, 0);
+    hTooltipIcons[TTI_ERROR] = LoadImageW(COMCTL32_hModule,
+        (LPCWSTR)MAKEINTRESOURCE(IDI_TT_ERROR_SM), IMAGE_ICON, 0, 0, 0);
 }
 
 
 VOID
 TOOLTIPS_Unregister (void)
 {
+    int i;
+    for (i = 0; i < TTI_ERROR+1; i++)
+        DeleteObject(hTooltipIcons[i]);
     UnregisterClassA (TOOLTIPS_CLASSA, NULL);
 }

reactos/lib/comctl32
trackbar.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- trackbar.c	8 May 2004 11:41:04 -0000	1.5
+++ trackbar.c	19 Sep 2004 09:50:06 -0000	1.6
@@ -112,7 +112,7 @@
     TRACE("(code=%d)\n", code);
 
     pnmh->hwndFrom = infoPtr->hwndSelf;
-    pnmh->idFrom = GetWindowLongW(infoPtr->hwndSelf, GWL_ID);
+    pnmh->idFrom = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID);
     pnmh->code = code;
     result = SendMessageW(infoPtr->hwndNotify, WM_NOTIFY,
 			  (WPARAM)pnmh->idFrom, (LPARAM)pnmh);
@@ -563,7 +563,8 @@
 static void
 TRACKBAR_DrawTics (TRACKBAR_INFO *infoPtr, HDC hdc, DWORD dwStyle)
 {
-    int i, ticFlags = dwStyle & 0x0f;
+    unsigned int i;
+    int ticFlags = dwStyle & 0x0f;
     LOGPEN ticPen = { PS_SOLID, {1, 0}, GetSysColor (COLOR_3DDKSHADOW) };
     HPEN hOldPen, hTicPen;
     
@@ -809,7 +810,7 @@
 
     ZeroMemory(&nmcd, sizeof(nmcd));
     nmcd.hdr.hwndFrom = infoPtr->hwndSelf;
-    nmcd.hdr.idFrom = GetWindowLongW (infoPtr->hwndSelf, GWL_ID);
+    nmcd.hdr.idFrom = GetWindowLongPtrW (infoPtr->hwndSelf, GWLP_ID);
     nmcd.hdr.code = NM_CUSTOMDRAW;
     nmcd.hdc = hdc;
 
@@ -1339,7 +1340,7 @@
 
     infoPtr = (TRACKBAR_INFO *)Alloc (sizeof(TRACKBAR_INFO));
     if (!infoPtr) return -1;
-    SetWindowLongW (hwnd, 0, (DWORD)infoPtr);
+    SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
 
     /* set default values */
     infoPtr->hwndSelf  = hwnd;
@@ -1401,7 +1402,7 @@
     	DestroyWindow (infoPtr->hwndToolTip);
 
     Free (infoPtr);
-    SetWindowLongW (infoPtr->hwndSelf, 0, 0);
+    SetWindowLongPtrW (infoPtr->hwndSelf, 0, 0);
     return 0;
 }
 
@@ -1635,7 +1636,7 @@
 static LRESULT WINAPI
 TRACKBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
-    TRACKBAR_INFO *infoPtr = (TRACKBAR_INFO *)GetWindowLongW (hwnd, 0);
+    TRACKBAR_INFO *infoPtr = (TRACKBAR_INFO *)GetWindowLongPtrW (hwnd, 0);
 
     TRACE("hwnd=%p msg=%x wparam=%x lparam=%lx\n", hwnd, uMsg, wParam, lParam);
 
@@ -1815,11 +1816,11 @@
 
     ZeroMemory (&wndClass, sizeof(WNDCLASSW));
     wndClass.style         = CS_GLOBALCLASS;
-    wndClass.lpfnWndProc   = (WNDPROC)TRACKBAR_WindowProc;
+    wndClass.lpfnWndProc   = TRACKBAR_WindowProc;
     wndClass.cbClsExtra    = 0;
     wndClass.cbWndExtra    = sizeof(TRACKBAR_INFO *);
     wndClass.hCursor       = LoadCursorW (0, (LPWSTR)IDC_ARROW);
-    wndClass.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1);
+    wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
     wndClass.lpszClassName = TRACKBAR_CLASSW;
 
     RegisterClassW (&wndClass);

reactos/lib/comctl32
treeview.c 1.9 -> 1.10
diff -u -r1.9 -r1.10
--- treeview.c	8 May 2004 11:41:05 -0000	1.9
+++ treeview.c	19 Sep 2004 09:50:06 -0000	1.10
@@ -225,7 +225,7 @@
 static TREEVIEW_INFO *
 TREEVIEW_GetInfoPtr(HWND hwnd)
 {
-    return (TREEVIEW_INFO *)GetWindowLongW(hwnd, 0);
+    return (TREEVIEW_INFO *)GetWindowLongPtrW(hwnd, 0);
 }
 
 /* Don't call this. Nothing wants an item index. */
@@ -458,7 +458,7 @@
 
     TRACE("%d\n", code);
     nmhdr.hwndFrom = hwnd;
-    nmhdr.idFrom = GetWindowLongW(hwnd, GWL_ID);
+    nmhdr.idFrom = GetWindowLongPtrW(hwnd, GWLP_ID);
     nmhdr.code = get_notifycode(infoPtr, code);
 
     return (BOOL)TREEVIEW_SendRealNotify(infoPtr,
@@ -513,7 +513,7 @@
     ZeroMemory(&nmhdr, sizeof(NMTREEVIEWA));
 
     nmhdr.hdr.hwndFrom = hwnd;
-    nmhdr.hdr.idFrom = GetWindowLongW(hwnd, GWL_ID);
+    nmhdr.hdr.idFrom = GetWindowLongPtrW(hwnd, GWLP_ID);
     nmhdr.hdr.code = get_notifycode(infoPtr, code);
     nmhdr.action = action;
 
@@ -547,7 +547,7 @@
     TRACE("code:%d dragitem:%p\n", code, dragItem);
 
     nmhdr.hdr.hwndFrom = hwnd;
-    nmhdr.hdr.idFrom = GetWindowLongW(hwnd, GWL_ID);
+    nmhdr.hdr.idFrom = GetWindowLongPtrW(hwnd, GWLP_ID);
     nmhdr.hdr.code = get_notifycode(infoPtr, code);
     nmhdr.action = 0;
     nmhdr.itemNew.mask = TVIF_STATE | TVIF_PARAM | TVIF_HANDLE;
@@ -576,7 +576,7 @@
 
     nmcd = &nmcdhdr.nmcd;
     nmcd->hdr.hwndFrom = hwnd;
-    nmcd->hdr.idFrom = GetWindowLongW(hwnd, GWL_ID);
+    nmcd->hdr.idFrom = GetWindowLongPtrW(hwnd, GWLP_ID);
     nmcd->hdr.code = NM_CUSTOMDRAW;
     nmcd->dwDrawStage = dwDrawStage;
     nmcd->hdc = hdc;
@@ -620,7 +620,7 @@
 
     nmcd = &nmcdhdr.nmcd;
     nmcd->hdr.hwndFrom = hwnd;
-    nmcd->hdr.idFrom = GetWindowLongW(hwnd, GWL_ID);
+    nmcd->hdr.idFrom = GetWindowLongPtrW(hwnd, GWLP_ID);
     nmcd->hdr.code = NM_CUSTOMDRAW;
     nmcd->dwDrawStage = dwDrawStage;
     nmcd->hdc = hdc;
@@ -653,7 +653,7 @@
     BOOL ret;
 
     tvdi.hdr.hwndFrom = hwnd;
-    tvdi.hdr.idFrom = GetWindowLongW(hwnd, GWL_ID);
+    tvdi.hdr.idFrom = GetWindowLongPtrW(hwnd, GWLP_ID);
     tvdi.hdr.code = get_notifycode(infoPtr, TVN_BEGINLABELEDITW);
 
     TREEVIEW_TVItemFromItem(infoPtr, TVIF_HANDLE | TVIF_STATE | TVIF_PARAM | TVIF_TEXT,
@@ -680,7 +680,7 @@
     if (mask == 0) return;
 
     callback.hdr.hwndFrom         = hwnd;
-    callback.hdr.idFrom           = GetWindowLongW(hwnd, GWL_ID);
+    callback.hdr.idFrom           = GetWindowLongPtrW(hwnd, GWLP_ID);
     callback.hdr.code             = get_notifycode(infoPtr, TVN_GETDISPINFOW);
 
     /* 'state' always contains valid value, as well as 'lParam'.
@@ -3463,7 +3463,7 @@
     HWND hwndEdit;
     SIZE sz;
     TREEVIEW_ITEM *editItem = hItem;
-    HINSTANCE hinst = (HINSTANCE)GetWindowLongW(hwnd, GWL_HINSTANCE);
+    HINSTANCE hinst = (HINSTANCE)GetWindowLongPtrW(hwnd, GWLP_HINSTANCE);
     HDC hdc;
     HFONT hOldFont=0;
     TEXTMETRICW textMetric;
@@ -3530,8 +3530,8 @@
     SendMessageW(hwndEdit, WM_SETFONT,
 		 (WPARAM)TREEVIEW_FontForItem(infoPtr, editItem), FALSE);
 
-    infoPtr->wpEditOrig = (WNDPROC)SetWindowLongW(hwndEdit, GWL_WNDPROC,
-						  (DWORD)
+    infoPtr->wpEditOrig = (WNDPROC)SetWindowLongPtrW(hwndEdit, GWLP_WNDPROC,
+						  (DWORD_PTR)
 						  TREEVIEW_Edit_SubclassProc);
 
     if (TREEVIEW_BeginLabelEditNotify(infoPtr, editItem))
@@ -3566,7 +3566,7 @@
 	return FALSE;
 
     tvdi.hdr.hwndFrom = hwnd;
-    tvdi.hdr.idFrom = GetWindowLongW(hwnd, GWL_ID);
+    tvdi.hdr.idFrom = GetWindowLongPtrW(hwnd, GWLP_ID);
     tvdi.hdr.code = get_notifycode(infoPtr, TVN_ENDLABELEDITW);
     tvdi.item.mask = 0;
     tvdi.item.hItem = editedItem;
@@ -4190,7 +4190,7 @@
     if (!hwnd || !charCode || !keyData)
         return 0;
 
-    infoPtr=(TREEVIEW_INFO*)GetWindowLongW(hwnd, 0);
+    infoPtr=(TREEVIEW_INFO*)GetWindowLongPtrW(hwnd, 0);
     if (!infoPtr)
         return 0;
 
@@ -4436,8 +4436,7 @@
 		SetScrollPos(infoPtr->hwnd, SB_VERT,
 		              newFirstVisible->visibleOrder, TRUE);
 
-	    ScrollWindow(infoPtr->hwnd, 0, scroll, NULL, NULL);
-	    UpdateWindow(infoPtr->hwnd);
+	    ScrollWindowEx(infoPtr->hwnd, 0, scroll, NULL, NULL, NULL, NULL, SW_ERASE | SW_INVALIDATE);
 	}
     }
 }
@@ -4634,6 +4633,7 @@
 static LRESULT
 TREEVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
 {
+    static const WCHAR szDisplayW[] = { 'D','I','S','P','L','A','Y','\0' };
     RECT rcClient;
     TREEVIEW_INFO *infoPtr;
 
@@ -4647,7 +4647,7 @@
 	return 0;
     }
 
-    SetWindowLongW(hwnd, 0, (DWORD)infoPtr);
+    SetWindowLongPtrW(hwnd, 0, (DWORD_PTR)infoPtr);
 
     infoPtr->hwnd = hwnd;
     infoPtr->dwStyle = GetWindowLongW(hwnd, GWL_STYLE);
@@ -4737,7 +4737,7 @@
 	infoPtr->himlState =
 	    ImageList_Create(16, 16, ILC_COLOR | ILC_MASK, 3, 0);
 
-	hdcScreen = CreateDCA("DISPLAY", NULL, NULL, NULL);
+	hdcScreen = CreateDCW(szDisplayW, NULL, NULL, NULL);
 
 	/* Create a coloured bitmap compatible with the screen depth
 	   because checkboxes are not black&white */
@@ -4785,11 +4785,11 @@
 
     /* Restore original wndproc */
     if (infoPtr->hwndEdit)
-	SetWindowLongW(infoPtr->hwndEdit, GWL_WNDPROC,
-		       (LONG)infoPtr->wpEditOrig);
+	SetWindowLongPtrW(infoPtr->hwndEdit, GWLP_WNDPROC,
+		       (DWORD_PTR)infoPtr->wpEditOrig);
 
     /* Deassociate treeview from the window before doing anything drastic. */
-    SetWindowLongW(infoPtr->hwnd, 0, (LONG)NULL);
+    SetWindowLongPtrW(infoPtr->hwnd, 0, (DWORD_PTR)NULL);
 
     DeleteObject(infoPtr->hBoldFont);
     Free(infoPtr);

reactos/lib/comctl32
updown.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- updown.c	15 Apr 2004 08:29:57 -0000	1.4
+++ updown.c	19 Sep 2004 09:50:06 -0000	1.5
@@ -95,7 +95,7 @@
 #define BUDDY_UPDOWN_HWND        "buddyUpDownHWND"
 #define BUDDY_SUPERCLASS_WNDPROC "buddySupperClassWndProc"
 
-#define UPDOWN_GetInfoPtr(hwnd) ((UPDOWN_INFO *)GetWindowLongA (hwnd,0))
+#define UPDOWN_GetInfoPtr(hwnd) ((UPDOWN_INFO *)GetWindowLongPtrW (hwnd,0))
 #define COUNT_OF(a) (sizeof(a)/sizeof(a[0]))
 
 static void UPDOWN_DoAction (UPDOWN_INFO *infoPtr, int delta, int action);
@@ -491,7 +491,7 @@
                when we reset the upDown ctrl buddy to another buddy because it is not
                good to break the window proc chain. */
             if (!GetPropA(bud, BUDDY_SUPERCLASS_WNDPROC)) {
-                baseWndProc = (WNDPROC)SetWindowLongW(bud, GWL_WNDPROC, (LPARAM)UPDOWN_Buddy_SubclassProc);
+                baseWndProc = (WNDPROC)SetWindowLongPtrW(bud, GWLP_WNDPROC, (LPARAM)UPDOWN_Buddy_SubclassProc);
                 SetPropA(bud, BUDDY_SUPERCLASS_WNDPROC, (HANDLE)baseWndProc);
             }
         }
@@ -572,7 +572,7 @@
     ni.iPos = infoPtr->CurVal;
     ni.iDelta = delta;
     ni.hdr.hwndFrom = infoPtr->Self;
-    ni.hdr.idFrom   = GetWindowLongW (infoPtr->Self, GWL_ID);
+    ni.hdr.idFrom   = GetWindowLongPtrW (infoPtr->Self, GWLP_ID);
     ni.hdr.code = UDN_DELTAPOS;
     if (!SendMessageW(infoPtr->Notify, WM_NOTIFY, (WPARAM)ni.hdr.idFrom, (LPARAM)&ni)) {
         /* Parent said: OK to adjust */
@@ -623,7 +623,7 @@
     if (GetCapture() == infoPtr->Self) {
 	NMHDR hdr;
 	hdr.hwndFrom = infoPtr->Self;
-	hdr.idFrom   = GetWindowLongW (infoPtr->Self, GWL_ID);
+	hdr.idFrom   = GetWindowLongPtrW (infoPtr->Self, GWLP_ID);
 	hdr.code = NM_RELEASEDCAPTURE;
 	SendMessageW(infoPtr->Notify, WM_NOTIFY, hdr.idFrom, (LPARAM)&hdr);
 	ReleaseCapture();
@@ -725,7 +725,7 @@
         case WM_CREATE:
             SetWindowLongW (hwnd, GWL_STYLE, dwStyle & ~WS_BORDER);
             infoPtr = (UPDOWN_INFO*)Alloc (sizeof(UPDOWN_INFO));
-	    SetWindowLongW (hwnd, 0, (DWORD)infoPtr);
+	    SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
 
 	    /* initialize the info struct */
 	    infoPtr->Self = hwnd;
@@ -753,7 +753,7 @@
 	    if(infoPtr->Buddy) RemovePropA(infoPtr->Buddy, BUDDY_UPDOWN_HWND);
 
 	    Free (infoPtr);
-	    SetWindowLongW (hwnd, 0, 0);
+	    SetWindowLongPtrW (hwnd, 0, 0);
 	    TRACE("UpDown Ctrl destruction, hwnd=%p\n", hwnd);
 	    break;
 
@@ -958,11 +958,11 @@
 
     ZeroMemory( &wndClass, sizeof( WNDCLASSW ) );
     wndClass.style         = CS_GLOBALCLASS | CS_VREDRAW | CS_HREDRAW;
-    wndClass.lpfnWndProc   = (WNDPROC)UpDownWindowProc;
+    wndClass.lpfnWndProc   = UpDownWindowProc;
     wndClass.cbClsExtra    = 0;
     wndClass.cbWndExtra    = sizeof(UPDOWN_INFO*);
     wndClass.hCursor       = LoadCursorW( 0, (LPWSTR)IDC_ARROW );
-    wndClass.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1);
+    wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
     wndClass.lpszClassName = UPDOWN_CLASSW;
 
     RegisterClassW( &wndClass );
CVSspam 0.2.8