Index: trunk/src/comctl32/CCBase.cpp
===================================================================
--- trunk/src/comctl32/CCBase.cpp	(revision 3406)
+++ trunk/src/comctl32/CCBase.cpp	(revision 3409)
@@ -1,3 +1,3 @@
-/* $Id: CCBase.cpp,v 1.7 2000-04-12 16:38:58 cbratschi Exp $ */
+/* $Id: CCBase.cpp,v 1.8 2000-04-16 18:26:55 cbratschi Exp $ */
 /*
  * COMCTL32 Base Functions and Macros for all Controls
@@ -346,4 +346,78 @@
 }
 
+//NOTE for lstrcmpni*: both buffers must be at least shortLen+1 characters long!
+
+INT lstrcmpniA(CHAR *textA,CHAR *textB,INT len)
+{
+  CHAR tmp1,tmp2;
+  INT res;
+
+  tmp1 = textA[len];
+  textA[len] = 0;
+  tmp2 = textB[len];
+  textB[len] = 0;
+
+  res = lstrcmpiA(textA,textB);
+
+  textA[len] = tmp1;
+  textB[len] = tmp2;
+  return res;
+}
+
+INT lstrcmpniAtoW(CHAR *textA,WCHAR* textB,INT len)
+{
+  WCHAR *tmp;
+  INT res;
+
+  tmp = (WCHAR*)COMCTL32_Alloc((len+1)*sizeof(WCHAR));
+  lstrcpynAtoW(tmp,textA,len+1);
+
+  res = lstrcmpniW(tmp,textB,len);
+
+  COMCTL32_Free(tmp);
+  return res;
+}
+
+
+INT lstrcmpniW(WCHAR *textA,WCHAR *textB,INT len)
+{
+  WCHAR tmp1,tmp2;
+  INT res;
+
+  tmp1 = textA[len];
+  textA[len] = 0;
+  tmp2 = textB[len];
+  textB[len] = 0;
+
+  res = lstrcmpiW(textA,textB);
+
+  textA[len] = tmp1;
+  textB[len] = tmp2;
+  return res;
+}
+
+INT lstrcmpniAW(WCHAR *textA,BOOL unicodeA,WCHAR *textB,BOOL unicodeB,INT len)
+{
+  if (unicodeA)
+  {
+    if (unicodeB)
+    {
+      return lstrcmpniW(textA,textB,len);
+    } else
+    {
+      return lstrcmpniAtoW((LPSTR)textB,textA,len);
+    }
+  } else
+  {
+    if (unicodeB)
+    {
+      return lstrcmpniAtoW((LPSTR)textA,textB,len);
+    } else
+    {
+      return lstrcmpniA((LPSTR)textA,(LPSTR)textB,len);
+    }
+  }
+}
+
 CHAR* lstrstrA(CHAR *text,CHAR *subtext)
 {
Index: trunk/src/comctl32/CCBase.h
===================================================================
--- trunk/src/comctl32/CCBase.h	(revision 3406)
+++ trunk/src/comctl32/CCBase.h	(revision 3409)
@@ -1,3 +1,3 @@
-/* $Id: CCBase.h,v 1.8 2000-04-12 16:38:58 cbratschi Exp $ */
+/* $Id: CCBase.h,v 1.9 2000-04-16 18:26:56 cbratschi Exp $ */
 /*
  * COMCTL32 Base Functions and Macros for all Controls
@@ -46,6 +46,16 @@
 VOID drawStubControl(HWND hwnd,HDC hdc);
 
+#define lstrlenAW(text,unicode) (unicode ? lstrlenW((WCHAR*)text):lstrlenA((CHAR*)text))
+
+#define lstrcpyAW(textA,unicodeA,textB,unicodeB) (unicodeA ? (unicodeB ? lstrcpyW((WCHAR*)textA,(WCHAR*)textB):lstrcpyAtoW((WCHAR*)textA,(CHAR*)textB)):(unicodeB ? lstrcpyWtoA((CHAR*)textA,(WCHAR*)textB):lstrcpyA((CHAR*)textA,(CHAR*)textB)))
+
 INT lstrcmpAtoW(CHAR *textA,WCHAR *textW);
 INT lstrcmpAW(WCHAR *textA,BOOL textaunicode,WCHAR *textB,BOOL textbunicode);
+
+//read note in CCBase.cpp!
+INT lstrcmpniA(CHAR *textA,CHAR *textB,INT len);
+INT lstrcmpniAtoW(CHAR *textA,WCHAR* textB,INT len);
+INT lstrcmpniW(WCHAR *textA,WCHAR *textB,INT len);
+INT lstrcmpniAW(WCHAR *textA,BOOL unicodeA,WCHAR *textB,BOOL unicodeB,INT len);
 
 CHAR*  lstrstrA(CHAR *text,CHAR *subtext);
@@ -55,3 +65,5 @@
 WCHAR* lstrstrAW(WCHAR *text,BOOL textunicode,WCHAR *subtext,BOOL subtextunicode);
 
+#define TICKDIFF(start,end) ((end > start) ? (end-start):(0xFFFFFFFF-start+end))
+
 #endif
Index: trunk/src/comctl32/comctl32.cpp
===================================================================
--- trunk/src/comctl32/comctl32.cpp	(revision 3406)
+++ trunk/src/comctl32/comctl32.cpp	(revision 3409)
@@ -1,3 +1,3 @@
-/* $Id: comctl32.cpp,v 1.1 2000-02-23 17:09:40 cbratschi Exp $ */
+/* $Id: comctl32.cpp,v 1.2 2000-04-16 18:26:57 cbratschi Exp $ */
 /*
  * Win32 common controls implementation
@@ -813,5 +813,9 @@
  *
  * NOTES
- *     Returns version of a comctl32.dll from IE4.01 SP1.
+ *     IE4.01 SP1:
+ *       4-72-3110-1
+ *
+ *     IE5:
+ *       5-80-2014-1
  */
 
@@ -826,7 +830,7 @@
     }
 
-    pdvi->dwMajorVersion = 4;
-    pdvi->dwMinorVersion = 72;
-    pdvi->dwBuildNumber = 3110;
+    pdvi->dwMajorVersion = 5;
+    pdvi->dwMinorVersion = 80;
+    pdvi->dwBuildNumber = 2014;
     pdvi->dwPlatformID = 1;
 
Index: trunk/src/comctl32/comctl32.h
===================================================================
--- trunk/src/comctl32/comctl32.h	(revision 3406)
+++ trunk/src/comctl32/comctl32.h	(revision 3409)
@@ -1,3 +1,3 @@
-/* $Id: comctl32.h,v 1.12 2000-02-18 17:13:37 cbratschi Exp $ */
+/* $Id: comctl32.h,v 1.13 2000-04-16 18:26:57 cbratschi Exp $ */
 /*
  * Win32 common controls implementation
@@ -91,4 +91,37 @@
 #define IDB_HIST_LARGE      131
 
+//direction bitmaps
+#define IDB_DIRECTION_ALL   132
+#define IDB_DIRECTION_NS    133
+#define IDB_DIRECTION WE    134
+
+//Header filter bitmap
+#define IDB_HEADER_FILTER   140
+
+//cursors
+#define IDC_COMCTL32_ERROR       20480
+#define IDC_COMCTL32_INFORMATION 20481
+#define IDC_COMCTL32_EXCLAMATION 20482
+
+#define IDC_COMCTL32_DRAGRECT      102
+#define IDC_COMCTL32_ARROW1        104
+#define IDC_COMCTL32_ARROW2        105
+#define IDC_COMCTL32_DRAGHLINE     106
+#define IDC_COMCTL32_SPLITHLINE    107
+#define IDC_COMCTL32_HAND          108
+#define IDC_COMCTL32_DIRECTION_NS  109
+#define IDC_COMCTL32_DIRECTION_WE  110
+#define IDC_COMCTL32_DIRECTION_ALL 111
+#define IDC_COMCTL32_DIRECTION_N   112
+#define IDC_COMCTL32_DIRECTION_S   113
+#define IDC_COMCTL32_DIRECTION_E   114
+#define IDC_COMCTL32_DIRECTION_W   115
+#define IDC_COMCTL32_DIRECTION_NE  116
+#define IDC_COMCTL32_DIRECTION_NW  117
+#define IDC_COMCTL32_DIRECTION_SE  118
+#define IDC_COMCTL32_DIRECTION_SW  119
+
+#define IDC_COMCTL32_SPLITVLINE    135
+#define IDC_COMCTL32_ENTER         150
 
 /* Month calendar month menu popup */
Index: trunk/src/comctl32/header.cpp
===================================================================
--- trunk/src/comctl32/header.cpp	(revision 3406)
+++ trunk/src/comctl32/header.cpp	(revision 3409)
@@ -1,3 +1,3 @@
-/* $Id: header.cpp,v 1.6 2000-04-15 14:22:15 cbratschi Exp $ */
+/* $Id: header.cpp,v 1.7 2000-04-16 18:26:57 cbratschi Exp $ */
 /*
  *  Header control
@@ -8,6 +8,4 @@
  *
  *  TODO:
- *   - Control specific cursors (over dividers)
- *
  *   - HDS_FILTERBAR
  *   - HEADER_SetHotDivider()
@@ -596,5 +594,5 @@
               *pFlags |= HHT_ONHEADER;
               *pItem = iCount;
-//                      TRACE (header, "ON HEADER %d\n", iCount);
+
               return;
             }
@@ -609,5 +607,5 @@
                   *pFlags |= HHT_ONDIVOPEN;
                   *pItem = iCount - 1;
-//                              TRACE (header, "ON DIVOPEN %d\n", *pItem);
+
                   return;
                 } else
@@ -615,5 +613,5 @@
                   *pFlags |= HHT_ONDIVIDER;
                   *pItem = iCount - 1;
-//                              TRACE (header, "ON DIVIDER %d\n", *pItem);
+
                   return;
                 }
@@ -626,5 +624,5 @@
               *pFlags |= HHT_ONDIVIDER;
               *pItem = iCount;
-//                      TRACE (header, "ON DIVIDER %d\n", *pItem);
+
               return;
             }
@@ -632,5 +630,5 @@
             *pFlags |= HHT_ONHEADER;
             *pItem = iCount;
-//                  TRACE (header, "ON HEADER %d\n", iCount);
+
             return;
           }
@@ -648,5 +646,5 @@
             *pFlags |= HHT_ONDIVOPEN;
             *pItem = infoPtr->uNumItem - 1;
-//                  TRACE (header, "ON DIVOPEN %d\n", *pItem);
+
             return;
           } else
@@ -654,5 +652,5 @@
             *pFlags |= HHT_ONDIVIDER;
             *pItem = infoPtr->uNumItem-1;
-//                  TRACE (header, "ON DIVIDER %d\n", *pItem);
+
             return;
           }
@@ -661,5 +659,5 @@
         *pFlags |= HHT_NOWHERE;
         *pItem = 1;
-//          TRACE (header, "NOWHERE\n");
+
         return;
       }
@@ -668,9 +666,7 @@
       if (lpPt->x < rect.left)
       {
-//         TRACE (header, "TO LEFT\n");
         *pFlags |= HHT_TOLEFT;
       } else if (lpPt->x > rect.right)
       {
-//          TRACE (header, "TO LEFT\n");
         *pFlags |= HHT_TORIGHT;
       }
@@ -678,9 +674,7 @@
       if (lpPt->y < rect.top)
       {
-//          TRACE (header, "ABOVE\n");
         *pFlags |= HHT_ABOVE;
       } else if (lpPt->y > rect.bottom)
       {
-//          TRACE (header, "BELOW\n");
         *pFlags |= HHT_BELOW;
       }
@@ -688,5 +682,5 @@
 
     *pItem = 1;
-//    TRACE (header, "flags=0x%X\n", *pFlags);
+
     return;
 }
@@ -973,6 +967,4 @@
     HDC hdc;
 
-//    TRACE(header, "[iItem=%d]\n", iItem);
-
     if ((iItem < 0) || (iItem >= (INT)infoPtr->uNumItem)) return FALSE;
 
@@ -989,5 +981,4 @@
     {
       HEADER_ITEM *oldItems = infoPtr->items;
-//        TRACE(header, "Complex delete! [iItem=%d]\n", iItem);
 
       if (infoPtr->items[iItem].pszText) COMCTL32_Free(infoPtr->items[iItem].pszText);
@@ -1408,8 +1399,4 @@
     lpLayout->pwpos->flags = SWP_NOZORDER;
 
-//    TRACE (header, "Layout x=%d y=%d cx=%d cy=%d\n",
-//           lpLayout->pwpos->x, lpLayout->pwpos->y,
-//           lpLayout->pwpos->cx, lpLayout->pwpos->cy);
-
     return TRUE;
 }
@@ -1539,7 +1526,7 @@
     infoPtr->hFont = 0;
     infoPtr->items = 0;
-    infoPtr->hcurArrow = LoadCursorA (0, IDC_ARROWA);
-    infoPtr->hcurDivider = LoadCursorA (0, IDC_SIZEWEA);
-    infoPtr->hcurDivopen = LoadCursorA (0, IDC_SIZENSA);
+    infoPtr->hcurArrow = LoadCursorA(0,IDC_ARROWA);
+    infoPtr->hcurDivider = LoadCursorA(COMCTL32_hModule,MAKEINTRESOURCEA(IDC_COMCTL32_DRAGHLINE));
+    infoPtr->hcurDivopen = LoadCursorA(COMCTL32_hModule,MAKEINTRESOURCEA(IDC_COMCTL32_SPLITHLINE));
     infoPtr->bCaptured = FALSE;
     infoPtr->bPressed  = FALSE;
@@ -1659,5 +1646,4 @@
         ReleaseDC (hwnd, hdc);
 
-//      TRACE (header, "Pressed item %d!\n", nItem);
     } else if ((flags == HHT_ONDIVIDER) || (flags == HHT_ONDIVOPEN))
     {
@@ -1680,5 +1666,4 @@
             }
 
-//          TRACE (header, "Begin tracking item %d!\n", nItem);
         }
     }
@@ -1883,5 +1868,4 @@
           }
         }
-//          TRACE (header, "Moving pressed item %d!\n", infoPtr->iMoveItem);
       } else if (infoPtr->bTracking)
       {
@@ -2083,6 +2067,4 @@
     INT   nItem;
 
-//    TRACE (header, "code=0x%X  id=0x%X\n", LOWORD(lParam), HIWORD(lParam));
-
     GetCursorPos (&pt);
     ScreenToClient (hwnd, &pt);
@@ -2263,7 +2245,7 @@
 
         default:
-//            if (msg >= WM_USER)
-//              ERR (header, "unknown msg %04x wp=%04x lp=%08lx\n",
-//                   msg, wParam, lParam );
+            //if (msg >= WM_USER)
+            //  ERR (header, "unknown msg %04x wp=%04x lp=%08lx\n",
+            //       msg, wParam, lParam );
             return defComCtl32ProcA (hwnd, msg, wParam, lParam);
     }
Index: trunk/src/comctl32/listview.cpp
===================================================================
--- trunk/src/comctl32/listview.cpp	(revision 3406)
+++ trunk/src/comctl32/listview.cpp	(revision 3409)
@@ -1,3 +1,3 @@
-/*$Id: listview.cpp,v 1.13 2000-04-15 14:22:19 cbratschi Exp $*/
+/*$Id: listview.cpp,v 1.14 2000-04-16 18:26:57 cbratschi Exp $*/
 /*
  * Listview control
@@ -15,4 +15,9 @@
  *   - rcView and origin (need testcase!!!)
  *   - rcView not updated in LVM_SETITEMPOSITION and other messages
+ *   - many position bugs
+ *   - work area not used
+ *   - custom draw
+ *   - drag'n'drop (-> treeview)
+ *   - edit timer
  *   - LISTVIEW_SetBkImage
  *   - LISTVIEW_GetBkImage
@@ -21,4 +26,15 @@
  *   - LVS_OWNERDRAWFIXED
  *   - LVS_EX_*
+ *       LVS_EX_CHECKBOXES
+ *       LVS_EX_TRACKSELECT
+ *       LVS_EX_FULLROWSELECT
+ *       LVS_EX_ONECLICKACTIVATE
+ *       LVS_EX_TWOCLICKACTIVATE
+ *       LVS_EX_FLATSB
+ *       LVS_EX_REGIONAL
+ *       LVS_EX_INFOTIP
+ *       LVS_EX_UNDERLINEHOT
+ *       LVS_EX_UNDERLINECOLD
+ *       LVS_EX_MULTIWORKAREAS
  *   - many things untested!
  *
@@ -26,9 +42,6 @@
  *   LISTVIEW_SetItemCount : not completed
  *
- * Advanced functionality:
- *   LISTVIEW_GetNumberOfWorkAreas : not implemented
- *   LISTVIEW_GetHoverTime : not implemented
- *   LISTVIEW_GetISearchString : not implemented
- *
+ * Status: all messages done, many styles not (yet) implemented
+ * Version: 5.80
  */
 
@@ -79,4 +92,7 @@
 #define LISTVIEW_SCROLL_DIV_SIZE 1
 
+#define DEFAULT_HOVERTIME    500
+#define LV_ISEARCH_DELAY     1000 //documented in ListView_Message_Processing.htm
+
 /*
  * macros
@@ -85,5 +101,4 @@
 /* retrieve the number of items in the listview */
 #define GETITEMCOUNT(infoPtr) ((infoPtr)->hdpaItems->nItemCount)
-
 
 HWND CreateEditLabel(LPCSTR text, DWORD style, INT x, INT y,
@@ -92,8 +107,4 @@
 
 #define LISTVIEW_GetInfoPtr(hwnd) ((LISTVIEW_INFO*)getInfoPtr(hwnd))
-
-INT WINAPI COMCTL32_StrCmpNIA(LPCSTR,LPCSTR,INT);
-
-#define strncasecmp COMCTL32_StrCmpNIA
 
 /*
@@ -965,4 +976,5 @@
   {
     LISTVIEW_GetItemPosition(hwnd, i, &ptItem);
+
     if (PtInRect(&rcSelRect, ptItem) != FALSE)
     {
@@ -1014,4 +1026,5 @@
     POINT ptSelMark;
     RECT rcSel;
+
     LISTVIEW_GetItemPosition(hwnd, nItem, &ptItem);
     LISTVIEW_GetItemPosition(hwnd, infoPtr->nSelectionMark, &ptSelMark);
@@ -1076,11 +1089,12 @@
   {
     if (nItem > 0)
-      LISTVIEW_RemoveSelections(hwnd, 0, nItem - 1);
+      LISTVIEW_RemoveSelections(hwnd,0,nItem);
 
     if (nItem < GETITEMCOUNT(infoPtr))
-      LISTVIEW_RemoveSelections(hwnd, nItem + 1, GETITEMCOUNT(infoPtr));
+      LISTVIEW_RemoveSelections(hwnd,nItem+1,GETITEMCOUNT(infoPtr));
   } else mask |= LVIS_SELECTED;
 
-  LISTVIEW_SetItemState(hwnd,infoPtr->nFocusedItem,0,mask);
+
+  if (infoPtr->nFocusedItem != nItem) LISTVIEW_SetItemState(hwnd,infoPtr->nFocusedItem,0,mask);
   LISTVIEW_SetItemState(hwnd,nItem,LVIS_SELECTED | LVIS_FOCUSED,LVIS_SELECTED | LVIS_FOCUSED);
 
@@ -1200,8 +1214,14 @@
   LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
   LISTVIEW_ITEM *lpItem;
-
-  while ((lpItem = (LISTVIEW_ITEM*)DPA_GetPtr(infoPtr->hdpaSelItems,0)) != NULL)
-  {
-    LISTVIEW_SetItemState(hwnd,DPA_GetPtrIndex(infoPtr->hdpaItems,lpItem),0,LVIS_SELECTED);
+  INT pos = 0;
+
+  while ((lpItem = (LISTVIEW_ITEM*)DPA_GetPtr(infoPtr->hdpaSelItems,pos)) != NULL)
+  {
+    INT nItem = DPA_GetPtrIndex(infoPtr->hdpaItems,lpItem);
+
+    if ((nItem >= nFirst) && (nItem < nLast))
+      LISTVIEW_SetItemState(hwnd,nItem,0,LVIS_SELECTED);
+    else
+      pos++;
   }
 }
@@ -1657,5 +1677,5 @@
   /* get information needed for drawing the item */
   ZeroMemory(&lvItem, sizeof(LVITEMW));
-  lvItem.header.mask = LVIF_TEXT;
+  lvItem.header.mask = LVIF_TEXT | LVIF_IMAGE;
   lvItem.header.iItem = nItem;
   lvItem.header.iSubItem = nSubItem;
@@ -1664,4 +1684,16 @@
   lvItem.mustFree = FALSE;
   LISTVIEW_GetItem(hwnd,(LPLVITEMW)&lvItem,TRUE,TRUE);
+
+  if (infoPtr->dwExStyle & LVS_EX_SUBITEMIMAGES)
+  {
+    /* small icons */
+    if (infoPtr->himlSmall)
+    {
+      ImageList_SetBkColor(infoPtr->himlSmall,CLR_NONE);
+      ImageList_Draw(infoPtr->himlSmall,lvItem.header.iImage,hdc,rcItem.left,rcItem.top,ILD_NORMAL);
+
+      rcItem.left += infoPtr->iconSize.cx;
+    }
+  }
 
   /* set item colors */
@@ -1915,6 +1947,6 @@
 
   /* add 1 for displaying a partial item at the bottom */
-  nLast = nItem + LISTVIEW_GetCountPerColumn(hwnd)+1;
-  nLast = min(nLast, GETITEMCOUNT(infoPtr));
+  nLast = nItem+LISTVIEW_GetCountPerColumn(hwnd)+1;
+  nLast = min(nLast,GETITEMCOUNT(infoPtr));
 
   /* send cache hint notification */
@@ -1945,7 +1977,7 @@
   }
 
-  for (; nItem < nLast; nItem++)
-  {
-    for (j = 0; j < nColumnCount; j++)
+  for (;nItem < nLast;nItem++)
+  {
+    for (j = 0;j < nColumnCount;j++)
     {
       rcItem = rcHeader[j];
@@ -1966,5 +1998,20 @@
     nDrawPosY += infoPtr->nItemHeight;
   }
+
 DR_END:
+  if (infoPtr->dwExStyle & LVS_EX_GRIDLINES)
+  {
+    HPEN hOldPen;
+
+    hOldPen = SelectObject(hdc,GetStockObject(BLACK_BRUSH));
+    for (j = 0;j < nColumnCount-1;j++)
+    {
+      MoveToEx(hdc,rcHeader[j].right+REPORT_MARGINX-1,infoPtr->rcList.top,NULL);
+      LineTo(hdc,rcHeader[j].right+REPORT_MARGINX-1,infoPtr->rcList.bottom);
+    }
+    SelectObject(hdc,hOldPen);
+  }
+
+
   COMCTL32_Free(rcHeader);
 }
@@ -3483,5 +3530,21 @@
 }
 
-/* LISTVIEW_GetHoverTime */
+static LRESULT LISTVIEW_GetHoverTime(HWND hwnd,WPARAM wParam,LPARAM lParam)
+{
+  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
+
+  return (LRESULT)infoPtr->hoverTime;
+}
+
+static LRESULT LISTVIEW_SetHoverTime(HWND hwnd,WPARAM wParam,LPARAM lParam)
+{
+  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
+  INT oldTime = infoPtr->hoverTime;
+
+  infoPtr->hoverTime = (INT)lParam;
+  if (infoPtr->hoverTime == -1) infoPtr->hoverTime = DEFAULT_HOVERTIME;
+
+  return (LRESULT)oldTime;
+}
 
 /***
@@ -3755,6 +3818,4 @@
 }
 
-/* LISTVIEW_GetHoverTime */
-
 /***
  * DESCRIPTION:
@@ -3843,4 +3904,20 @@
 }
 
+static BOOL LISTVIEW_GetSubItemPosition(HWND hwnd,INT nItem,INT nSubItem,LPPOINT lpptPosition)
+{
+  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
+  RECT rect;
+
+  if (Header_GetItemRect(infoPtr->hwndHeader,nSubItem,&rect))
+  {
+    lpptPosition->x = rect.left+REPORT_MARGINX;
+    lpptPosition->y = ((nItem-LISTVIEW_GetTopIndex(hwnd))*infoPtr->nItemHeight)+infoPtr->rcList.top;
+
+    return TRUE;
+  }
+
+  return FALSE;
+}
+
 /***
  * DESCRIPTION:
@@ -3858,5 +3935,5 @@
 static LRESULT LISTVIEW_GetItemRect(HWND hwnd,INT nItem,LPRECT lprc,INT code)
 {
-  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd);
+  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
   BOOL bResult = FALSE;
   POINT ptOrigin;
@@ -4177,4 +4254,69 @@
 }
 
+static LRESULT LISTVIEW_GetSubItemRect(HWND hwnd,INT nItem,LPRECT lprc)
+{
+  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
+  INT nSubItem,code,nLabelWidth;
+  POINT ptItem;
+
+  if (!lprc || (infoPtr->uView != LVS_REPORT) || (nItem < 0) || (nItem >= GETITEMCOUNT(infoPtr))) return FALSE;
+
+  nSubItem = lprc->top;
+  if ((nSubItem < 0) || (nSubItem >= Header_GetItemCount(infoPtr->hwndHeader))) return FALSE;
+  if (!LISTVIEW_GetSubItemPosition(hwnd,nItem,nSubItem,&ptItem)) return FALSE;
+
+  code = lprc->left;
+
+  switch (code)
+  {
+    case LVIR_BOUNDS:
+      lprc->left = ptItem.x;
+      lprc->right = lprc->left;
+      lprc->top = ptItem.y;
+      lprc->bottom = lprc->top+infoPtr->nItemHeight;
+
+      if ((infoPtr->dwExStyle & LVS_EX_SUBITEMIMAGES) && infoPtr->himlSmall)
+      {
+        lprc->right += infoPtr->iconSize.cx;
+      }
+
+      nLabelWidth = LISTVIEW_GetLabelWidth(hwnd,nItem,nSubItem);
+      lprc->right += nLabelWidth;
+      break;
+
+    case LVIR_ICON:
+      if (infoPtr->dwExStyle & LVS_EX_SUBITEMIMAGES)
+      {
+        lprc->left = ptItem.x;
+        lprc->top = ptItem.y;
+        lprc->bottom = lprc->top+infoPtr->nItemHeight;
+
+        if (infoPtr->himlSmall)
+        {
+          lprc->right = lprc->left+infoPtr->iconSize.cx;
+        } else
+        {
+          lprc->right = lprc->left;
+        }
+        break;
+      } else return FALSE;
+
+    case LVIR_LABEL:
+      lprc->left = ptItem.x;
+      lprc->right = lprc->left;
+      lprc->top = ptItem.y;
+      lprc->bottom = lprc->top+infoPtr->nItemHeight;
+
+      nLabelWidth = LISTVIEW_GetLabelWidth(hwnd,nItem,nSubItem);
+      lprc->right += nLabelWidth;
+      break;
+
+    default:
+      return FALSE;
+  }
+
+  return TRUE;
+}
+
 /***
  * DESCRIPTION:
@@ -4220,5 +4362,5 @@
 LRESULT LISTVIEW_GetItemSpacing(HWND hwnd, BOOL bSmall)
 {
-  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd);
+  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
   LONG lResult;
 
@@ -4450,5 +4592,54 @@
 }
 
-/* LISTVIEW_GetNumberOfWorkAreas */
+static LRESULT LISTVIEW_GetNumberOfWorkAreas(HWND hwnd,WPARAM wParam,LPARAM lParam)
+{
+  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
+  LPINT lpuWorkAreas = (LPINT)lParam;
+
+  if (!lpuWorkAreas) return FALSE;
+
+  *lpuWorkAreas = infoPtr->nWorkAreas;
+
+  return TRUE;
+}
+
+static LRESULT LISTVIEW_GetWorkAreas(HWND hwnd,WPARAM wParam,LPARAM lParam)
+{
+  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
+  INT nWorkAreas = (INT)wParam;
+  LPRECT lprc = (LPRECT)lParam;
+
+  if ((nWorkAreas <= 0) || (nWorkAreas > infoPtr->nWorkAreas) || !lprc) return FALSE;
+
+  for (INT x = 0;x < nWorkAreas;x++)
+    lprc[x] = infoPtr->rcWorkAreas[x];
+
+  return TRUE;
+}
+
+static LRESULT LISTVIEW_SetWorkAreas(HWND hwnd,WPARAM wParam,LPARAM lParam)
+{
+  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
+  INT nWorkAreas = (INT)wParam;
+  LPRECT lprc = (LPRECT)lParam;
+
+  if ((nWorkAreas < 0) || (nWorkAreas > LV_MAX_WORKAREAS)) return FALSE;
+
+  COMCTL32_Free(infoPtr->rcWorkAreas);
+  if ((nWorkAreas == 0) || !lprc)
+  {
+    infoPtr->nWorkAreas = 0;
+    infoPtr->rcWorkAreas = NULL;
+  } else
+  {
+    infoPtr->nWorkAreas = nWorkAreas;
+    infoPtr->rcWorkAreas = (LPRECT)COMCTL32_Alloc(nWorkAreas*sizeof(RECT));
+    for (INT x = 0;x < nWorkAreas;x++)
+     infoPtr->rcWorkAreas[x] = lprc[x];
+  }
+
+  return TRUE;
+}
+
 
 /***
@@ -4466,5 +4657,5 @@
 static LRESULT LISTVIEW_GetOrigin(HWND hwnd, LPPOINT lpptOrigin)
 {
-  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd);
+  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
 
   if ((infoPtr->uView == LVS_SMALLICON) || (infoPtr->uView == LVS_ICON))
@@ -4516,5 +4707,5 @@
 static LRESULT LISTVIEW_GetSelectionMark(HWND hwnd)
 {
-  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd);
+  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
 
   return infoPtr->nSelectionMark;
@@ -4597,7 +4788,48 @@
 }
 
-static BOOL LISTVIEW_InternalHitTestItem(HWND hwnd,LISTVIEW_INFO *infoPtr,INT nItem,LPLVHITTESTINFO lpHitTestInfo)
+static BOOL LISTVIEW_InternalHitTestItem(HWND hwnd,LISTVIEW_INFO *infoPtr,INT nItem,LPLVHITTESTINFO lpHitTestInfo,BOOL checkSubItems)
 {
   RECT rcItem;
+
+  if (checkSubItems && (infoPtr->uView == LVS_REPORT))
+  {
+    INT nColumnCount = Header_GetItemCount(infoPtr->hwndHeader);
+    INT xDiff = -infoPtr->lefttop.x*infoPtr->scrollStep.x;
+
+    rcItem.top = infoPtr->rcList.top+(nItem-LISTVIEW_GetTopIndex(hwnd))*infoPtr->nItemHeight;
+    rcItem.bottom = rcItem.top+infoPtr->nItemHeight;
+    for (INT x = 0;x < nColumnCount;x++)
+    {
+      RECT rcColumn;
+
+      Header_GetItemRect(infoPtr->hwndHeader,x,&rcColumn);
+      rcItem.left = xDiff+REPORT_MARGINX+rcColumn.left;
+      rcItem.right = xDiff+rcColumn.right-REPORT_MARGINX;
+      if (PtInRect(&rcItem,lpHitTestInfo->pt))
+      {
+        rcItem.top = x;
+        rcItem.left = LVIR_BOUNDS;
+        if (LISTVIEW_GetSubItemRect(hwnd,nItem,&rcItem) && PtInRect(&rcItem,lpHitTestInfo->pt))
+        {
+          rcItem.top = x;
+          rcItem.left = LVIR_ICON;
+          if (LISTVIEW_GetSubItemRect(hwnd,nItem,&rcItem) && PtInRect(&rcItem,lpHitTestInfo->pt))
+          {
+            lpHitTestInfo->flags = LVHT_ONITEMICON;
+            lpHitTestInfo->iItem = nItem;
+            lpHitTestInfo->iSubItem = x;
+            return TRUE;
+          }
+
+          lpHitTestInfo->flags = LVHT_ONITEMLABEL;
+          lpHitTestInfo->iItem = nItem;
+          lpHitTestInfo->iSubItem = x;
+
+          return TRUE;
+        }
+      }
+    }
+    return FALSE;
+  }
 
   if (LISTVIEW_GetItemRect(hwnd,nItem,&rcItem,LVIR_BOUNDS))
@@ -4657,5 +4889,5 @@
     if (nItem >= GETITEMCOUNT(infoPtr)) return -1;
 
-    if (LISTVIEW_InternalHitTestItem(hwnd,infoPtr,nItem,lpHitTestInfo))
+    if (LISTVIEW_InternalHitTestItem(hwnd,infoPtr,nItem,lpHitTestInfo,FALSE))
       return nItem;
   } else if (infoPtr->uView == LVS_LIST)
@@ -4668,5 +4900,5 @@
     if (nItem >= GETITEMCOUNT(infoPtr)) return -1;
 
-    if (LISTVIEW_InternalHitTestItem(hwnd,infoPtr,nItem,lpHitTestInfo))
+    if (LISTVIEW_InternalHitTestItem(hwnd,infoPtr,nItem,lpHitTestInfo,FALSE))
       return nItem;
   } else
@@ -4676,5 +4908,5 @@
     for (i = 0; i < GETITEMCOUNT(infoPtr); i++)
     {
-      if (LISTVIEW_InternalHitTestItem(hwnd,infoPtr,i,lpHitTestInfo))
+      if (LISTVIEW_InternalHitTestItem(hwnd,infoPtr,i,lpHitTestInfo,FALSE))
         return i;
     }
@@ -4700,5 +4932,5 @@
 static LRESULT LISTVIEW_HitTest(HWND hwnd, LPLVHITTESTINFO lpHitTestInfo)
 {
-  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd);
+  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
   INT nItem = -1;
 
@@ -4708,6 +4940,5 @@
   {
     lpHitTestInfo->flags = LVHT_TOLEFT;
-  }
-  else if (infoPtr->rcList.right < lpHitTestInfo->pt.x)
+  } else if (infoPtr->rcList.right < lpHitTestInfo->pt.x)
   {
     lpHitTestInfo->flags = LVHT_TORIGHT;
@@ -4716,6 +4947,5 @@
   {
     lpHitTestInfo->flags |= LVHT_ABOVE;
-  }
-  else if (infoPtr->rcList.bottom < lpHitTestInfo->pt.y)
+  } else if (infoPtr->rcList.bottom < lpHitTestInfo->pt.y)
   {
     lpHitTestInfo->flags |= LVHT_BELOW;
@@ -4729,4 +4959,43 @@
   return nItem;
 }
+
+static LRESULT LISTVIEW_SubItemHitTest(HWND hwnd,LPLVHITTESTINFO lpHitTestInfo)
+{
+  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
+  INT nItem = -1;
+  INT nSubItem = -1;
+
+  lpHitTestInfo->flags = 0;
+  if (infoPtr->uView != LVS_REPORT) return -1;
+
+  if (infoPtr->rcList.left > lpHitTestInfo->pt.x)
+  {
+    lpHitTestInfo->flags = LVHT_TOLEFT;
+  } else if (infoPtr->rcList.right < lpHitTestInfo->pt.x)
+  {
+    lpHitTestInfo->flags = LVHT_TORIGHT;
+  }
+  if (infoPtr->rcList.top > lpHitTestInfo->pt.y)
+  {
+    lpHitTestInfo->flags |= LVHT_ABOVE;
+  } else if (infoPtr->rcList.bottom < lpHitTestInfo->pt.y)
+  {
+    lpHitTestInfo->flags |= LVHT_BELOW;
+  }
+
+  if (lpHitTestInfo->flags == 0)
+  {
+    INT nTop = LISTVIEW_GetTopIndex(hwnd),nItem;
+
+    nItem = nTop+((lpHitTestInfo->pt.y-infoPtr->rcList.top)/infoPtr->nItemHeight);
+    if (nItem >= GETITEMCOUNT(infoPtr)) return -1;
+
+    if (LISTVIEW_InternalHitTestItem(hwnd,infoPtr,nItem,lpHitTestInfo,TRUE))
+      return lpHitTestInfo->iSubItem;
+  }
+
+  return nSubItem;
+}
+
 
 /***
@@ -5418,7 +5687,32 @@
   /* store previous style */
   dwOldStyle = infoPtr->dwExStyle;
+
   /* set new style */
   infoPtr->dwExStyle = (dwOldStyle & ~dwMask) | (dwStyle & dwMask);
-  return (dwOldStyle);
+
+  //update report view
+  if ((((dwOldStyle & LVS_EX_GRIDLINES) != (infoPtr->dwExStyle & LVS_EX_GRIDLINES)) ||
+       ((dwOldStyle & LVS_EX_SUBITEMIMAGES) != (infoPtr->dwExStyle & LVS_EX_SUBITEMIMAGES))) &&
+      (infoPtr->uView == LVS_REPORT))
+  {
+    LISTVIEW_Refresh(hwnd);
+  }
+
+  //update header
+  if ((dwOldStyle & LVS_EX_HEADERDRAGDROP) != (infoPtr->dwExStyle & LVS_EX_HEADERDRAGDROP))
+  {
+    if (infoPtr->hwndHeader)
+    {
+      DWORD dwStyle = GetWindowLongA(infoPtr->hwndHeader,GWL_STYLE);
+
+      if (infoPtr->dwExStyle & LVS_EX_HEADERDRAGDROP)
+        dwStyle |= HDS_DRAGDROP;
+      else
+        dwStyle &= ~HDS_DRAGDROP;
+      SetWindowLongA(infoPtr->hwndHeader,GWL_STYLE,dwStyle);
+    }
+  }
+
+  return dwOldStyle;
 }
 
@@ -5481,5 +5775,24 @@
 }
 
-/* LISTVIEW_SetIconSpacing */
+static LRESULT LISTVIEW_SetIconSpacing(HWND hwnd,WPARAM wParam,LPARAM lParam)
+{
+  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
+  DWORD oldIS = MAKELONG(infoPtr->iconSpacing.cx,infoPtr->iconSpacing.cy);
+  INT cx = LOWORD(lParam),cy = HIWORD(lParam);
+
+  if (cx == -1) cx = GetSystemMetrics(SM_CXICONSPACING);
+  if (cy == -1) cy = GetSystemMetrics(SM_CYICONSPACING);
+  if ((cx != infoPtr->iconSpacing.cx) || (cy != infoPtr->iconSpacing.cy))
+  {
+    infoPtr->iconSpacing.cx = cx;
+    infoPtr->iconSpacing.cy = cy;
+    if (((infoPtr->uView == LVS_ICON) || (infoPtr->uView == LVS_SMALLICON)) && (infoPtr->dwStyle & LVS_AUTOARRANGE))
+    {
+      LISTVIEW_Arrange(hwnd,LVA_DEFAULT);
+    }
+  }
+
+  return oldIS;
+}
 
 /***
@@ -5498,5 +5811,5 @@
 static LRESULT LISTVIEW_SetImageList(HWND hwnd, INT nType, HIMAGELIST himl)
 {
-  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd);
+  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
   HIMAGELIST himlTemp = 0;
 
@@ -5877,4 +6190,5 @@
 
   infoPtr->nSelectionMark = nIndex;
+
   return nOldIndex;
 }
@@ -5932,5 +6246,4 @@
 /* LISTVIEW_SetToolTips */
 /* LISTVIEW_SetUnicodeFormat */
-/* LISTVIEW_SetWorkAreas */
 
 /***
@@ -6085,4 +6398,5 @@
   infoPtr->pedititem = NULL;
   infoPtr->bDoEditLabel = FALSE;
+  infoPtr->hoverTime = DEFAULT_HOVERTIME;
 
   /* get default font (icon title) */
@@ -6099,6 +6413,5 @@
 
   /* set header font */
-  SendMessageA(infoPtr->hwndHeader, WM_SETFONT, (WPARAM)infoPtr->hFont,
-               (LPARAM)TRUE);
+  SendMessageA(infoPtr->hwndHeader,WM_SETFONT,(WPARAM)infoPtr->hFont,(LPARAM)TRUE);
 
   if (uView == LVS_ICON)
@@ -6106,6 +6419,5 @@
     infoPtr->iconSize.cx = GetSystemMetrics(SM_CXICON);
     infoPtr->iconSize.cy = GetSystemMetrics(SM_CYICON);
-  }
-  else if (uView == LVS_REPORT)
+  } else if (uView == LVS_REPORT)
   {
     if (!(LVS_NOCOLUMNHEADER & lpcs->style))
@@ -6116,6 +6428,5 @@
     infoPtr->iconSize.cx = GetSystemMetrics(SM_CXSMICON);
     infoPtr->iconSize.cy = GetSystemMetrics(SM_CYSMICON);
-  }
-  else
+  } else
   {
     infoPtr->iconSize.cx = GetSystemMetrics(SM_CXSMICON);
@@ -6130,4 +6441,9 @@
   infoPtr->nItemWidth = LISTVIEW_GetItemWidth(hwnd);
   infoPtr->nItemHeight = LISTVIEW_GetItemHeight(hwnd);
+
+  //create tooltip
+  infoPtr->hwndToolTip = createToolTip(hwnd,TTF_TRACK | TTF_ABSOLUTE | TTF_TRANSPARENT,TRUE);
+  SendMessageA(infoPtr->hwndToolTip,WM_SETFONT,infoPtr->hFont,0);
+
 
   return 0;
@@ -6479,236 +6795,172 @@
 }
 
-/************************ Defines that LISTVIEW_ProcessLetterKeys uses *******************************/
-#define KEY_DELAY       900
-#define LISTVIEW_InitLvItemStruct(item,idx,TEXT)  \
-                    ZeroMemory(&(item), sizeof(LVITEMA)); \
-                    (item).mask = LVIF_TEXT; \
-                    (item).iItem = (idx); \
-                    (item).iSubItem = 0; \
-                    (item).pszText = (CHAR*)&(TEXT); \
-                    (item).cchTextMax = MAX_PATH
-
-/************************************************************************************************************************
-* DESCRIPTION:
-*       Processes keyboard messages generated by pressing the letter keys on the keyboard.
-*       Assumes the list is sorted alphabetically, without regard to case.
-*
-* PARAMETERS:
-*       [ I ]   HWND: handle to the window
-*       [ I ]   WPARAM: the character code, the actual character
-*       [ I ]   LPARAM: key data
-*
-*
-* RETURN:
-*       Zero.
-*
-* CHANGE LOG:
-*       Feb 17, 2000 -------------> Creation of function.
-*       Feb 22, 2000 -------------> Added macros.
-* TODO:
-*
-*
-************************************************************************************************************************/
-static INT LISTVIEW_ProcessLetterKeys( HWND hwnd, WPARAM charCode, LPARAM keyData )
-{
-    LISTVIEW_INFO *infoPtr = NULL;
-    INT nItem = -1;
-    INT nSize = 0;
-    INT idx = 0;
-    BOOL bFoundMatchingFiles = FALSE;
-    LVITEMA item;
-    CHAR TEXT[ MAX_PATH ];
-    CHAR szCharCode[ 2 ];
-    DWORD timeSinceLastKeyPress = 0;
-
-    sprintf( szCharCode, "%c", charCode );
-
-    /* simple parameter checking  */
-    if ( !hwnd || !charCode || !keyData )
-        return 0;
-
-    infoPtr = (LISTVIEW_INFO*)getInfoPtr(hwnd);
-
-    if ( !infoPtr )
-        return 0;
-
-    /* only allow the valid WM_CHARs through */
-    if ( isalnum( charCode ) || charCode == '.' || charCode == '`' || charCode == '!'
-          || charCode == '@' || charCode == '#' || charCode == '$' || charCode == '%'
-          || charCode == '^' || charCode == '&' || charCode == '*' || charCode == '('
-          || charCode == ')' || charCode == '-' || charCode == '_' || charCode == '+'
-          || charCode == '=' || charCode == '\\'|| charCode == ']' || charCode == '}'
-          || charCode == '[' || charCode == '{' || charCode == '/' || charCode == '?'
-          || charCode == '>' || charCode == '<' || charCode == ',' || charCode == '~')
-    {
-        timeSinceLastKeyPress = GetTickCount();
-
-        nSize = GETITEMCOUNT( infoPtr );
-        /* if there are 0 items, there is no where to go */
-        if ( nSize == 0 )
-            return 0;
-        /*
-         * If the last charCode equals the current charCode then look
-         * to the next element in list to see if it matches the previous
-         * charCode.
-         */
-        if ( infoPtr->charCode == charCode )
-        {
-            if ( timeSinceLastKeyPress - infoPtr->timeSinceLastKeyPress < KEY_DELAY )
-            {    /* append new character to search string */
-                lstrcatA( infoPtr->szSearchParam, szCharCode );
-                infoPtr->nSearchParamLength++;
-
-                /* loop from start of list view */
-                for( idx = infoPtr->nFocusedItem; idx < nSize; idx++ )
-                {   /* get item */
-                    LISTVIEW_InitLvItemStruct( item, idx, TEXT );
-                    LISTVIEW_GetItem(hwnd,(LVITEMW*)&item,FALSE,FALSE);//CB:todo
-
-                    /* compare items */
-                    if ( strncasecmp( item.pszText, infoPtr->szSearchParam,
-                                      infoPtr->nSearchParamLength ) == 0 )
-                    {
-                        nItem = idx;
-                        break;
-                    }
-                }
-            }
-            else if ( infoPtr->timeSinceLastKeyPress > timeSinceLastKeyPress )
-            { /* The DWORD went over it's boundery?? Ergo assuming too slow??. */
-                for ( idx = 0; idx < nSize; idx++ )
-                {
-                    LISTVIEW_InitLvItemStruct( item, idx, TEXT );
-                    LISTVIEW_GetItem(hwnd,(LVITEMW*)&item,FALSE,FALSE);//CB:todo
-
-                    if ( strncasecmp( &( item.pszText[ 0 ] ), szCharCode, 1 ) == 0 )
-                    {
-                        nItem = idx;
-                        break;
-                    }
-                }
-                lstrcpyA( infoPtr->szSearchParam, szCharCode );
-                infoPtr->nSearchParamLength = 1;
-            }
-            else
-            {   /* Save szCharCode for use in later searches */
-                lstrcpyA( infoPtr->szSearchParam, szCharCode );
-                infoPtr->nSearchParamLength = 1;
-
-                LISTVIEW_InitLvItemStruct( item, infoPtr->nFocusedItem + 1, TEXT );
-                LISTVIEW_GetItem(hwnd,(LVITEMW*)&item,FALSE,FALSE);//CB:todo
-
-                if ( strncasecmp( &( item.pszText[ 0 ] ), szCharCode, 1 ) == 0 )
-                    nItem = infoPtr->nFocusedItem + 1;
-                else
-                {   /*
-                     * Ok so there are no more folders that match
-                     * now we look for files.
-                     */
-                    for ( idx = infoPtr->nFocusedItem + 1; idx < nSize; idx ++ )
-                    {
-                        LISTVIEW_InitLvItemStruct( item, idx, TEXT );
-                        LISTVIEW_GetItem(hwnd,(LVITEMW*)&item,FALSE,FALSE);//CB:todo
-
-                        if ( strncasecmp( &( item.pszText[ 0 ] ), szCharCode, 1 ) == 0 )
-                        {
-                            nItem = idx;
-                            bFoundMatchingFiles = TRUE;
-                            break;
-                        }
-                    }
-                    if ( !bFoundMatchingFiles )
-                    {  /* go back to first instance */
-                        for ( idx = 0; idx < nSize; idx ++ )
-                        {
-                            LISTVIEW_InitLvItemStruct( item,idx, TEXT );
-                            LISTVIEW_GetItem(hwnd,(LVITEMW*)&item,FALSE,FALSE);//CB:todo
-
-                            if ( strncasecmp( &( item.pszText[ 0 ] ), szCharCode, 1 ) == 0 )
-                            {
-                                nItem = idx;
-                                break;
-                            }
-                        }
-                    }
-                }
-            }
-        } /*END: if ( infoPtr->charCode == charCode )*/
-
-        else /* different keypressed */
-        {
-            /* could be that they are spelling the file/directory for us */
-            if ( timeSinceLastKeyPress - infoPtr->timeSinceLastKeyPress > KEY_DELAY )
-            {   /*
-                 * Too slow, move to the first instance of the
-                 * charCode.
-                 */
-                for ( idx = 0; idx < nSize; idx++ )
-                {
-                    LISTVIEW_InitLvItemStruct( item,idx, TEXT );
-                    LISTVIEW_GetItem(hwnd,(LVITEMW*)&item,FALSE,FALSE);//CB:todo
-
-                    if ( strncasecmp( &( item.pszText[ 0 ] ), szCharCode, 1 ) == 0 )
-                    {
-                        nItem = idx;
-                        break;
-                    }
-                }
-                lstrcpyA( infoPtr->szSearchParam, szCharCode );
-                infoPtr->nSearchParamLength = 1;
-            }
-            else if ( infoPtr->timeSinceLastKeyPress > timeSinceLastKeyPress )
-            {  /* The DWORD went over it's boundery?? Ergo assuming too slow??. */
-                for ( idx = 0; idx < nSize; idx++ )
-                {
-                    LISTVIEW_InitLvItemStruct( item,idx, TEXT );
-                    LISTVIEW_GetItem(hwnd,(LVITEMW*)&item,FALSE,FALSE);//CB:todo
-
-                    if ( strncasecmp( &( item.pszText[ 0 ] ), szCharCode, 1 ) == 0 )
-                    {
-                        nItem = idx;
-                        break;
-                    }
-                }
-                lstrcpyA( infoPtr->szSearchParam, szCharCode );
-                infoPtr->nSearchParamLength = 1;
-            }
-            else /* Search for the string the user is typing */
-            {
-                /* append new character to search string */
-                lstrcatA( infoPtr->szSearchParam, szCharCode );
-                infoPtr->nSearchParamLength++;
-
-                /* loop from start of list view */
-                for( idx = 0; idx < nSize; idx++ )
-                {   /* get item */
-                    LISTVIEW_InitLvItemStruct( item, idx, TEXT );
-                    LISTVIEW_GetItem(hwnd,(LVITEMW*)&item,FALSE,FALSE);//CB:todo
-
-                    /* compare items */
-                    if ( strncasecmp( item.pszText, infoPtr->szSearchParam,
-                                      infoPtr->nSearchParamLength ) == 0 )
-                    {
-                        nItem = idx;
-                        break;
-                    }
-                }
-            }
-        }/*END: else */
-    }
+static BOOL LISTVIEW_Compare(HWND hwnd,INT nItem,LPWSTR text,INT textlen,BOOL *matchLast)
+{
+  BOOL res;
+  INT itemlen;
+  LVINTERNALITEMW lvItem;
+
+  ZeroMemory(&lvItem,sizeof(LVITEMW));
+  lvItem.header.mask = LVIF_TEXT;
+  lvItem.header.iItem = nItem;
+  lvItem.header.cchTextMax = DISP_TEXT_SIZE;
+  lvItem.mustFree = FALSE;
+  LISTVIEW_GetItem(hwnd,(LPLVITEMW)&lvItem,TRUE,TRUE);
+
+  itemlen = lstrlenAW(lvItem.header.pszText,lvItem.unicode);
+  if (itemlen < textlen)
+  {
+    res = FALSE;
+  } else
+  {
+    res = (lstrcmpniAW(lvItem.header.pszText,lvItem.unicode,text,TRUE,textlen) == 0);
+  }
+  if (!res && matchLast)
+  {
+    textlen--;
+    if ((textlen > 0) && (itemlen >= textlen))
+      *matchLast = (lstrcmpniAW(lvItem.header.pszText,lvItem.unicode,text,TRUE,textlen) == 0);
     else
-        return 0;
-
-    LISTVIEW_KeySelection(hwnd, nItem );
-
-    /* Store the WM_CHAR for next time */
-    infoPtr->charCode = charCode;
-
-    /* Store time */
-    infoPtr->timeSinceLastKeyPress = timeSinceLastKeyPress;
-
-    return 0;
-
-}/*END:LISTVIEW_ProcessLetterKeys( HWND hwndParent, INT nVirtualKey, LONG lKeyData ) */
+      *matchLast = FALSE;
+  }
+  if (lvItem.mustFree) COMCTL32_Free(lvItem.header.pszText);
+
+  return res;
+}
+
+static INT LISTVIEW_Search(HWND hwnd,LISTVIEW_INFO *infoPtr,INT iItem,LPWSTR text,INT textlen,INT *nearest)
+{
+  INT start,item;
+  BOOL bMatchLast;
+
+  start = iItem;
+  if (nearest) *nearest = -1;
+
+  //search start to end
+  for (item = start;item < GETITEMCOUNT(infoPtr);item++)
+  {
+    if (nearest)
+    {
+      if (LISTVIEW_Compare(hwnd,item,text,textlen,(*nearest == -1) ? &bMatchLast:NULL))
+        return item;
+      else if ((*nearest == -1) && bMatchLast)
+        *nearest = item;
+    } else
+    {
+      if (LISTVIEW_Compare(hwnd,item,text,textlen,NULL))
+        return item;
+    }
+  }
+
+  //search first to start
+  for (item = 0;item < start;item++)
+  {
+    if (nearest)
+    {
+      if (LISTVIEW_Compare(hwnd,item,text,textlen,(*nearest == -1) ? &bMatchLast:NULL))
+        return item;
+      else if ((*nearest == -1) && bMatchLast)
+        *nearest = item;
+    } else
+    {
+      if (LISTVIEW_Compare(hwnd,item,text,textlen,NULL))
+        return item;
+    }
+  }
+
+  return -1;
+}
+
+//NOTE: sister function in treeview control -> sync changes
+
+static VOID LISTVIEW_ISearch(HWND hwnd,CHAR ch)
+{
+  LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(hwnd);
+  LPWSTR newString;
+  INT len,item,nearest = -1;
+  CHAR ch2[2];
+  DWORD dwISearchTime;
+  BOOL checkNearest = TRUE;
+
+  //check timer
+  dwISearchTime = GetTickCount();
+  if ((infoPtr->uISearchLen > 0) && (TICKDIFF(infoPtr->dwISearchTime,dwISearchTime) > LV_ISEARCH_DELAY))
+  {
+    COMCTL32_Free(infoPtr->pszISearch);
+    infoPtr->pszISearch = NULL;
+    infoPtr->uISearchLen = 0;
+  }
+
+  //prepare new search string
+  len = infoPtr->uISearchLen+1;
+  newString = (WCHAR*)COMCTL32_Alloc((len+1)*sizeof(WCHAR));
+
+  if (infoPtr->uISearchLen > 0) lstrcpyW(newString,infoPtr->pszISearch);
+
+  ch2[0] = ch;
+  ch2[1] = 0;
+  lstrcpyAtoW((LPWSTR)&newString[len-1],(LPSTR)&ch2);
+  for (INT x = 1;x < len;x++)
+  {
+    if (newString[0] != newString[x])
+    {
+      checkNearest = FALSE;
+      break;
+    }
+  }
+
+  //search
+
+  //start with selected item or root
+  if (infoPtr->nFocusedItem != -1)
+  {
+    item = infoPtr->nFocusedItem;
+
+    //check if new string is valid for old selection
+    if (LISTVIEW_Compare(hwnd,item,newString,len,NULL))
+      goto ISearchDone;
+
+    //no match, continue with next item
+    item++;
+  } else item = 0;
+
+  //scan
+  item = LISTVIEW_Search(hwnd,infoPtr,item,newString,len,checkNearest ? &nearest:NULL);
+
+  if ((item == -1) && (nearest != -1))
+  {
+    LISTVIEW_SetSelection(hwnd,nearest);
+    LISTVIEW_EnsureVisible(hwnd,nearest,FALSE);
+    infoPtr->dwISearchTime = GetTickCount();
+
+    COMCTL32_Free(newString);
+    return;
+  }
+
+ISearchDone:
+  //done
+  if (item != -1)
+  {
+    COMCTL32_Free(infoPtr->pszISearch);
+    infoPtr->pszISearch = newString;
+    infoPtr->uISearchLen = len;
+    LISTVIEW_SetSelection(hwnd,item);
+    LISTVIEW_EnsureVisible(hwnd,item,FALSE);
+    infoPtr->dwISearchTime = GetTickCount();
+  } else
+  {
+    COMCTL32_Free(newString);
+    MessageBeep(0xFFFFFFFF);
+  }
+}
+
+static LRESULT LISTVIEW_Char(HWND hwnd,WPARAM wParam,LPARAM lParam)
+{
+  CHAR ch = (CHAR)wParam;
+
+  LISTVIEW_ISearch(hwnd,ch);
+
+  return 0;
+}
 
 /***
@@ -6939,4 +7191,7 @@
   LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
 
+  //destroy tooltip
+  destroyToolTip(infoPtr->hwndToolTip);
+
   /* delete all items */
   LISTVIEW_DeleteAllItems(hwnd);
@@ -7202,8 +7457,9 @@
   if (hFont == 0)
   {
+    if (infoPtr->hFont == infoPtr->hDefaultFont) return 0;
     infoPtr->hFont = infoPtr->hDefaultFont;
-  }
-  else
-  {
+  } else
+  {
+    if (infoPtr->hFont == hFont) return 0;
     infoPtr->hFont = hFont;
   }
@@ -7212,7 +7468,9 @@
   {
     /* set header font */
-    SendMessageA(infoPtr->hwndHeader, WM_SETFONT, (WPARAM)hFont,
-                   MAKELPARAM(fRedraw, 0));
-  }
+    SendMessageA(infoPtr->hwndHeader,WM_SETFONT,(WPARAM)hFont,MAKELPARAM(fRedraw,0));
+  }
+
+  //set tooltip font
+  SendMessageA(infoPtr->hwndToolTip,WM_SETFONT,(WPARAM)hFont,fRedraw);
 
   /* invalidate listview control client area */
@@ -7735,7 +7993,39 @@
 static LRESULT LISTVIEW_GetISearchString(HWND hwnd,WPARAM wParam,LPARAM lParam,BOOL unicode)
 {
+  LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(hwnd);
+  LPWSTR lpsz = (LPWSTR)lParam;
+
+  if (infoPtr->uISearchLen == 0) return 0;
+
+  if (unicode)
+    lstrcpyW(lpsz,infoPtr->pszISearch);
+  else
+    lstrcpyWtoA((LPSTR)lpsz,infoPtr->pszISearch);
+
+  return infoPtr->uISearchLen;
+}
+
+static LRESULT LISTVIEW_GetToolTips(HWND hwnd,WPARAM wParam,LPARAM lParam)
+{
+  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
+
+  return infoPtr->hwndToolTip;
+}
+
+static LRESULT LISTVIEW_SetToolTips(HWND hwnd,WPARAM wParam,LPARAM lParam)
+{
+  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
+  HWND oldToolTip = infoPtr->hwndToolTip;
+
+  infoPtr->hwndToolTip = (HWND)lParam;
+
+  return oldToolTip;
+}
+
+static LRESULT LISTVIEW_MouseMove(HWND hwnd,WPARAM wParam,LPARAM lParam)
+{
   //CB: todo
 
-  return 0;
+  return DefWindowProcA(hwnd,WM_MOUSEMOVE,wParam,lParam);
 }
 
@@ -7756,5 +8046,4 @@
       return LISTVIEW_Arrange(hwnd, (INT)wParam);
 
-
     case LVM_CREATEDRAGIMAGE:
       return LISTVIEW_CreateDragImage(hwnd,wParam,lParam);
@@ -7826,5 +8115,6 @@
       return LISTVIEW_GetHotItem(hwnd);
 
-/*      case LVM_GETHOVERTIME: */
+    case LVM_GETHOVERTIME:
+      return LISTVIEW_GetHoverTime(hwnd,wParam,lParam);
 
     case LVM_GETIMAGELIST:
@@ -7867,5 +8157,6 @@
       return LISTVIEW_GetNextItem(hwnd, (INT)wParam, LOWORD(lParam));
 
-/*      case LVM_GETNUMBEROFWORKAREAS: */
+    case LVM_GETNUMBEROFWORKAREAS:
+      return LISTVIEW_GetNumberOfWorkAreas(hwnd,wParam,lParam);
 
     case LVM_GETORIGIN:
@@ -7884,5 +8175,6 @@
       return LISTVIEW_GetStringWidth(hwnd,0,(LPWSTR)lParam,TRUE);
 
-/*      case LVM_GETSUBITEMRECT: */
+    case LVM_GETSUBITEMRECT:
+      return LISTVIEW_GetSubItemRect(hwnd,(INT)wParam,(LPRECT)lParam);
 
     case LVM_GETTEXTBKCOLOR:
@@ -7892,5 +8184,6 @@
       return LISTVIEW_GetTextColor(hwnd);
 
-/*      case LVM_GETTOOLTIPS: */
+    case LVM_GETTOOLTIPS:
+      return LISTVIEW_GetToolTips(hwnd,wParam,lParam);
 
     case LVM_GETTOPINDEX:
@@ -7900,8 +8193,9 @@
       return LISTVIEW_GetViewRect(hwnd, (LPRECT)lParam);
 
-/*      case LVM_GETWORKAREAS: */
+    case LVM_GETWORKAREAS:
+      return LISTVIEW_GetWorkAreas(hwnd,wParam,lParam);
 
     case LVM_HITTEST:
-      return LISTVIEW_HitTest(hwnd, (LPLVHITTESTINFO)lParam);
+      return LISTVIEW_HitTest(hwnd,(LPLVHITTESTINFO)lParam);
 
     case LVM_INSERTCOLUMNA:
@@ -7956,6 +8250,9 @@
       return LISTVIEW_SetHotItem(hwnd, (INT)wParam);
 
-/*      case LVM_SETHOVERTIME: */
-/*      case LVM_SETICONSPACING: */
+    case LVM_SETHOVERTIME:
+      return LISTVIEW_SetHoverTime(hwnd,wParam,lParam);
+
+    case LVM_SETICONSPACING:
+      return LISTVIEW_SetIconSpacing(hwnd,wParam,lParam);
 
     case LVM_SETIMAGELIST:
@@ -7995,11 +8292,15 @@
       return LISTVIEW_SetTextColor(hwnd, (COLORREF)lParam);
 
-/*      case LVM_SETTOOLTIPS: */
-/*      case LVM_SETWORKAREAS: */
+    case LVM_SETTOOLTIPS:
+      return LISTVIEW_SetToolTips(hwnd,wParam,lParam);
+
+    case LVM_SETWORKAREAS:
+      return LISTVIEW_SetWorkAreas(hwnd,wParam,lParam);
 
     case LVM_SORTITEMS:
       return LISTVIEW_SortItems(hwnd, wParam, lParam);
 
-/*      case LVM_SUBITEMHITTEST: */
+    case LVM_SUBITEMHITTEST:
+      return LISTVIEW_SubItemHitTest(hwnd,(LPLVHITTESTINFO)lParam);
 
     case LVM_UPDATE:
@@ -8007,5 +8308,5 @@
 
     case WM_CHAR:
-      return LISTVIEW_ProcessLetterKeys( hwnd, wParam, lParam );
+      return LISTVIEW_Char(hwnd,wParam,lParam);
 
     case WM_COMMAND:
@@ -8019,5 +8320,5 @@
 
     case WM_GETDLGCODE:
-      return DLGC_WANTCHARS | DLGC_WANTARROWS;
+      return DLGC_WANTCHARS | DLGC_WANTTAB | DLGC_WANTARROWS;
 
     case WM_GETFONT:
@@ -8042,6 +8343,6 @@
       return LISTVIEW_LButtonUp(hwnd,(WORD)wParam,LOWORD(lParam),HIWORD(lParam));
 
-/*      case WM_MOUSEMOVE: */
-/*          return LISTVIEW_MouseMove (hwnd, wParam, lParam); */
+    case WM_MOUSEMOVE:
+      return LISTVIEW_MouseMove (hwnd,wParam,lParam);
 
     case WM_NCCREATE:
Index: trunk/src/comctl32/rsrc.orc
===================================================================
--- trunk/src/comctl32/rsrc.orc	(revision 3406)
+++ trunk/src/comctl32/rsrc.orc	(revision 3409)
@@ -1,3 +1,3 @@
-/* $Id: rsrc.orc,v 1.3 2000-03-21 17:30:44 cbratschi Exp $ */
+/* $Id: rsrc.orc,v 1.4 2000-04-16 18:26:59 cbratschi Exp $ */
 #include "winuser.h"
 #include "comctl32.h"
@@ -104,4 +104,5 @@
 }
 
+/* 120 */
 IDB_STD_SMALL BITMAP LOADONCALL DISCARDABLE
 {
@@ -222,4 +223,5 @@
 }
 
+/* 121 */
 IDB_STD_LARGE BITMAP LOADONCALL DISCARDABLE
 {
@@ -400,5 +402,5 @@
 }
 
-/* BINRES idb_view_small.bmp */
+/* 124 */
 IDB_VIEW_SMALL BITMAP LOADONCALL DISCARDABLE
 {
@@ -665,4 +667,5 @@
 }
 
+/* 125 */
 IDB_VIEW_LARGE BITMAP LOADONCALL MOVEABLE DISCARDABLE
 {
@@ -811,4 +814,5 @@
 }
 
+/* 130 */
 IDB_HIST_SMALL BITMAP LOADONCALL DISCARDABLE
 {
@@ -854,4 +858,5 @@
 }
 
+/* 131 */
 IDB_HIST_LARGE BITMAP LOADONCALL DISCARDABLE
 {
@@ -928,7 +933,239 @@
 }
 
+/* 132 */
+IDB_DIRECTION_ALL BITMAP LOADONCALL DISCARDABLE
+{
+        '42 4D BC 00 00 00 00 00 00 00 3E 00 00 00 28 00'
+        '00 00 1C 00 00 00 1C 00 00 00 01 00 01 00 00 00'
+        '00 00 70 00 00 00 00 00 00 00 00 00 00 00 02 00'
+        '00 00 00 00 00 00 FF FF FF 00 80 80 80 00 00 00'
+        '00 00 00 00 00 00 00 00 00 00 00 06 00 00 00 0F'
+        '00 00 00 1F 80 00 00 3F C0 00 00 7F E0 00 00 00'
+        '00 00 01 00 08 00 03 00 0C 00 07 00 0E 00 0F 06'
+        '0F 00 1F 0F 0F 80 1F 0F 0F 80 0F 06 0F 00 07 00'
+        '0E 00 03 00 0C 00 01 00 08 00 00 00 00 00 00 7F'
+        'E0 00 00 3F C0 00 00 1F 80 00 00 0F 00 00 00 06'
+        '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 00 00 00'
+}
+
+/* 133 */
+IDB_DIRECTION_NS BITMAP LOADONCALL DISCARDABLE
+{
+        '42 4D BC 00 00 00 00 00 00 00 3E 00 00 00 28 00'
+        '00 00 1C 00 00 00 1C 00 00 00 01 00 01 00 00 00'
+        '00 00 70 00 00 00 00 00 00 00 00 00 00 00 02 00'
+        '00 00 00 00 00 00 FF FF FF 00 80 80 80 00 00 00'
+        '00 00 00 00 00 00 00 00 00 00 00 06 00 00 00 0F'
+        '00 00 00 1F 80 00 00 3F C0 00 00 7F E0 00 00 FF'
+        'F0 00 01 FF F8 00 00 00 00 00 00 00 00 00 00 06'
+        '00 00 00 0F 00 00 00 0F 00 00 00 06 00 00 00 00'
+        '00 00 00 00 00 00 01 FF F8 00 00 FF F0 00 00 7F'
+        'E0 00 00 3F C0 00 00 1F 80 00 00 0F 00 00 00 06'
+        '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 00 00 00'
+}
+
+/* 134 */
+IDB_DIRECTION_WE BITMAP LOADONCALL DISCARDABLE
+{
+        '42 4D BC 00 00 00 00 00 00 00 3E 00 00 00 28 00'
+        '00 00 1C 00 00 00 1C 00 00 00 01 00 01 00 00 00'
+        '00 00 70 00 00 00 00 00 00 00 00 00 00 00 02 00'
+        '00 00 00 00 00 00 FF FF FF 00 80 80 80 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 00 00 00 00 00 40 20 00 00 C0'
+        '30 00 01 C0 38 00 03 C0 3C 00 07 C0 3E 00 0F C6'
+        '3F 00 1F CF 3F 80 1F CF 3F 80 0F C6 3F 00 07 C0'
+        '3E 00 03 C0 3C 00 01 C0 38 00 00 C0 30 00 00 40'
+        '20 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 00 00 00 00 00 00'
+        '00 00 00 00 00 00 00 00 00 00 00 00'
+}
+
+/* 140 */
+IDB_HEADER_FILTER BITMAP LOADONCALL DISCARDABLE
+{
+        '42 4D D6 00 00 00 00 00 00 00 76 00 00 00 28 00'
+        '00 00 0D 00 00 00 0C 00 00 00 01 00 04 00 00 00'
+        '00 00 60 00 00 00 00 00 00 00 00 00 00 00 10 00'
+        '00 00 00 00 00 00 00 00 00 00 80 00 00 00 00 80'
+        '00 00 80 80 00 00 00 00 80 00 80 00 80 00 00 80'
+        '80 00 C0 C0 C0 00 80 80 80 00 FF 00 00 00 00 FF'
+        '00 00 FF FF 00 00 00 00 FF 00 FF 00 FF 00 00 FF'
+        'FF 00 FF FF FF 00 44 44 44 44 44 44 40 00 44 44'
+        '40 00 44 44 40 00 44 44 48 70 44 44 40 00 44 44'
+        '48 70 44 44 40 00 44 44 48 70 44 44 40 00 44 44'
+        '48 70 44 44 40 00 44 44 8F 78 04 44 40 00 44 48'
+        'F7 77 80 44 40 00 44 8F 77 77 78 04 40 00 48 FF'
+        'FF FF FF 80 40 00 48 88 88 88 88 80 40 00 44 44'
+        '44 44 44 44 40 00'
+}
+
+/*
+#define IDC_COMCTL32_ERROR       20480
+#define IDC_COMCTL32_INFORMATION 20481
+#define IDC_COMCTL32_EXCLAMATION 20482
+*/
+
+/* 102 */
+IDC_COMCTL32_DRAGRECT CURSOR LOADONCALL DISCARDABLE
+{
+        '00 00 02 00 01 00 20 20 02 00 10 00 10 00 30 01'
+        '00 00 16 00 00 00 28 00 00 00 20 00 00 00 40 00'
+        '00 00 01 00 01 00 00 00 00 00 00 02 00 00 00 00'
+        '00 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00'
+        '00 00 FF FF FF 00 00 00 00 00 00 00 00 00 00 00'
+        'F8 00 0A AA FA A0 15 54 F9 40 08 01 F8 20 10 03'
+        'F8 40 08 07 FC 20 10 07 FC 40 08 05 FC 20 10 05'
+        'F4 40 08 05 54 20 10 01 54 40 08 01 50 20 10 01'
+        '50 40 08 01 50 20 10 00 40 40 08 00 00 20 10 00'
+        '00 40 08 00 00 20 10 00 00 40 08 00 00 20 10 00'
+        '00 40 0A AA AA A0 15 55 55 40 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 00 00 00 FF FF FF FF FF FF FF FF FF FF'
+        '07 FF F5 55 05 5F EA AB 06 BF F7 FE 07 DF EF FC'
+        '07 BF F7 F8 03 DF EF F8 03 BF F7 FA 03 DF EF FA'
+        '0B BF F7 FA AB DF EF FE AB BF F7 FE AF DF EF FE'
+        'AF BF F7 FE AF DF EF FF BF BF F7 FF FF DF EF FF'
+        'FF BF F7 FF FF DF EF FF FF BF F7 FF FF DF EF FF'
+        'FF BF F5 55 55 5F EA AA AA BF FF FF FF FF FF FF'
+        'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
+        'FF FF FF FF FF FF'
+}
+
+/* 104 */
+IDC_COMCTL32_ARROW1 CURSOR LOADONCALL DISCARDABLE
+{
+        '00 00 02 00 01 00 20 20 02 00 00 00 00 00 30 01'
+        '00 00 16 00 00 00 28 00 00 00 20 00 00 00 40 00'
+        '00 00 01 00 01 00 00 00 00 00 00 02 00 00 00 00'
+        '00 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00'
+        '00 00 FF FF FF 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 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 00 00 00 00 00 00 00 01 80'
+        '00 00 01 80 00 00 03 00 00 00 03 00 00 00 06 00'
+        '00 00 46 00 00 00 6C 00 00 00 7C 00 00 00 7F 80'
+        '00 00 7F 00 00 00 7E 00 00 00 7C 00 00 00 78 00'
+        '00 00 70 00 00 00 60 00 00 00 40 00 00 00 00 00'
+        '00 00 00 00 00 00 FF FF FF FF FF FF FF FF FF FF'
+        'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
+        'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
+        'FF FF FF FF FF FF FF FF FF FF FE 7F FF FF FC 3F'
+        'FF FF FC 3F FF FF F8 7F FF FF 78 7F FF FF 30 FF'
+        'FF FF 10 FF FF FF 01 FF FF FF 00 3F FF FF 00 3F'
+        'FF FF 00 7F FF FF 00 FF FF FF 01 FF FF FF 03 FF'
+        'FF FF 07 FF FF FF 0F FF FF FF 1F FF FF FF 3F FF'
+        'FF FF 7F FF FF FF'
+}
+
+/* 105 */
+IDC_COMCTL32_ARROW2 CURSOR LOADONCALL DISCARDABLE
+{
+        '00 00 02 00 01 00 20 20 02 00 00 00 00 00 30 01'
+        '00 00 16 00 00 00 28 00 00 00 20 00 00 00 40 00'
+        '00 00 01 00 01 00 00 00 00 00 00 02 00 00 00 00'
+        '00 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00'
+        '00 00 FF FF FF 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 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 00 00 00 00 00 00 00 01 80'
+        '00 00 01 80 00 00 03 00 00 00 03 00 00 00 06 00'
+        '00 00 46 00 00 00 64 00 00 00 7C 00 00 00 7F 80'
+        '00 00 7F 00 00 00 7E 00 00 00 7C 00 00 00 78 00'
+        '00 00 70 00 00 00 60 00 00 00 40 00 00 00 00 00'
+        '00 00 00 00 00 00 FF FF FF FF FF FF FF FF FF FF'
+        'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
+        'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
+        'FF FF FF FF FF FF FF FF FF FF FE 7F FF FF FC 3F'
+        'FF FF FC 3F FF FF F8 7F FF FF F8 7F FF FF 30 FF'
+        'FF FF 10 FF FF FF 01 FF FF FF 00 3F FF FF 00 3F'
+        'FF FF 00 7F FF FF 00 FF FF FF 01 FF FF FF 03 FF'
+        'FF FF 07 FF FF FF 0F FF FF FF 1F FF FF FF 3F FF'
+        'FF FF 7F FF FF FF'
+}
+
+/* 106 */
+IDC_COMCTL32_DRAGHLINE CURSOR LOADONCALL DISCARDABLE
+{
+        '00 00 02 00 01 00 20 20 02 00 08 00 08 00 30 01'
+        '00 00 16 00 00 00 28 00 00 00 20 00 00 00 40 00'
+        '00 00 01 00 01 00 00 00 00 00 00 02 00 00 00 00'
+        '00 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00'
+        '00 00 FF FF FF 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 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 00 00 00 00 00 00 00 01 E0'
+        '00 00 01 20 00 00 01 20 00 00 01 20 00 00 01 20'
+        '00 00 19 26 00 00 29 25 00 00 4F 3C 80 00 80 00'
+        '40 00 80 00 40 00 4F 3C 80 00 29 25 00 00 19 26'
+        '00 00 01 20 00 00 01 20 00 00 01 20 00 00 01 20'
+        '00 00 01 E0 00 00 FF FF FF FF FF FF FF FF FF FF'
+        'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
+        'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
+        'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FE 1F'
+        'FF FF FE 1F FF FF FE 1F FF FF FE 1F FF FF FE 1F'
+        'FF FF E6 19 FF FF C6 18 FF FF 80 00 7F FF 00 00'
+        '3F FF 00 00 3F FF 80 00 7F FF C6 18 FF FF E6 19'
+        'FF FF FE 1F FF FF FE 1F FF FF FE 1F FF FF FE 1F'
+        'FF FF FE 1F FF FF'
+}
+
+/* 107 */
+IDC_COMCTL32_SPLITHLINE CURSOR LOADONCALL DISCARDABLE
+{
+        '00 00 02 00 01 00 20 20 02 00 08 00 08 00 30 01'
+        '00 00 16 00 00 00 28 00 00 00 20 00 00 00 40 00'
+        '00 00 01 00 01 00 00 00 00 00 00 02 00 00 00 00'
+        '00 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00'
+        '00 00 FF FF FF 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 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 00 00 00 00 00 00 00 03 F0'
+        '00 00 02 D0 00 00 02 D0 00 00 02 D0 00 00 02 D0'
+        '00 00 1A D6 00 00 2A D5 00 00 4E DC 80 00 80 C0'
+        '40 00 80 C0 40 00 4E DC 80 00 2A D5 00 00 1A D6'
+        '00 00 02 D0 00 00 02 D0 00 00 02 D0 00 00 02 D0'
+        '00 00 03 F0 00 00 FF FF FF FF FF FF FF FF FF FF'
+        'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
+        'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
+        'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FC 0F'
+        'FF FF FC 0F FF FF FC 0F FF FF FC 0F FF FF FC 0F'
+        'FF FF E4 09 FF FF C4 08 FF FF 80 00 7F FF 00 00'
+        '3F FF 00 00 3F FF 80 00 7F FF C4 08 FF FF E4 09'
+        'FF FF FC 0F FF FF FC 0F FF FF FC 0F FF FF FC 0F'
+        'FF FF FC 0F FF FF'
+}
+
+/*
+#define IDC_COMCTL32_HAND          108
+#define IDC_COMCTL32_DIRECTION_NS  109
+#define IDC_COMCTL32_DIRECTION_WE  110
+#define IDC_COMCTL32_DIRECTION_ALL 111
+#define IDC_COMCTL32_DIRECTION_N   112
+#define IDC_COMCTL32_DIRECTION_S   113
+#define IDC_COMCTL32_DIRECTION_E   114
+#define IDC_COMCTL32_DIRECTION_W   115
+#define IDC_COMCTL32_DIRECTION_NE  116
+#define IDC_COMCTL32_DIRECTION_NW  117
+#define IDC_COMCTL32_DIRECTION_SE  118
+#define IDC_COMCTL32_DIRECTION_SW  119
+
+#define IDC_COMCTL32_SPLITVLINE    135
+#define IDC_COMCTL32_ENTER         150
+*/
+
 /////////////////////////////////////////////////////////////////////////////
 //
-// Version (based on NT 4 SP3 user32.dll)
+// Version of the week
+//
+// based on NT 4 SP3 user32.dll:
+//   ProductVersion: 4.72.3110.1
+//   FileVersion:    4.72
+//
+// Windows 2000 (or IE 5 on any system):
+//   ProductVersion: 5.00.2014.216
+//   FileVersion:    5.80
 //
 
@@ -948,6 +1185,6 @@
             VALUE "Comments", "Odin32 System Dll\0"
             VALUE "CompanyName", "Odin Team\0"
-            VALUE "FileDescription", "COMCTL32 System Dll\0"
-            VALUE "FileVersion", "4.72.3110.1\0"
+            VALUE "FileDescription", "Common Controls Library\0"
+            VALUE "FileVersion", "5.80\0"
             VALUE "InternalName", "COMCTL32\0"
             VALUE "LegalCopyright", "Copyright (C) 1999-2000\0"
@@ -955,5 +1192,5 @@
             VALUE "OriginalFilename", "COMCTL32.DLL\0"
             VALUE "ProductName", "Odin32 - COMCTL32\0"
-            VALUE "ProductVersion", "4.72.3110.1\0"
+            VALUE "ProductVersion", "5.00.2014.216\0"
         END
     END
Index: trunk/src/comctl32/treeview.cpp
===================================================================
--- trunk/src/comctl32/treeview.cpp	(revision 3406)
+++ trunk/src/comctl32/treeview.cpp	(revision 3409)
@@ -1,3 +1,3 @@
-/* $Id: treeview.cpp,v 1.9 2000-04-15 14:22:31 cbratschi Exp $ */
+/* $Id: treeview.cpp,v 1.10 2000-04-16 18:26:59 cbratschi Exp $ */
 /* Treeview control
  *
@@ -1702,9 +1702,4 @@
       return 0;
 
-    case TV_ISEARCH_TIMER:
-      KillTimer(hwnd,TV_ISEARCH_TIMER);
-      infoPtr->Timer &= ~TV_ISEARCH_TIMER_SET;
-      return 0;
-
     case TV_INFOTIP_TIMER:
       TREEVIEW_CheckInfoTip(hwnd);
@@ -2760,5 +2755,5 @@
   infoPtr = (TREEVIEW_INFO*)initControl(hwnd,sizeof(TREEVIEW_INFO));
 
-  if (infoPtr == NULL) return 0;
+  if (!infoPtr) return 0;
 
   hdc = GetDC(hwnd);
@@ -4385,5 +4380,5 @@
 TREEVIEW_SelectItem (HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
-  return TREEVIEW_DoSelectItem (hwnd, wParam, (HTREEITEM) lParam, TVC_UNKNOWN);
+  return TREEVIEW_DoSelectItem(hwnd,wParam,(HTREEITEM)lParam,TVC_UNKNOWN);
 }
 
@@ -4842,8 +4837,9 @@
 }
 
-static BOOL TREEVIEW_Compare(HWND hwnd,TREEVIEW_ITEM *item,LPWSTR text,INT textlen)
+static BOOL TREEVIEW_Compare(HWND hwnd,TREEVIEW_ITEM *item,LPWSTR text,INT textlen,BOOL *matchLast)
 {
   WCHAR* itemtext;
   BOOL mustFree = FALSE,res;
+  INT itemlen;
 
   if (item->pszText == LPSTR_TEXTCALLBACKW)
@@ -4852,6 +4848,20 @@
     itemtext = item->pszText;
 
-  //simulate lstrcmpniW
-  res = (CompareStringW(LOCALE_SYSTEM_DEFAULT,NORM_IGNORECASE,itemtext,MIN(lstrlenW(itemtext),textlen),text,textlen) == 2);
+  itemlen = lstrlenW(itemtext);
+  if (itemlen < textlen)
+  {
+    res = FALSE;
+  } else
+  {
+    res = (lstrcmpniW(itemtext,text,textlen) == 0);
+  }
+  if (!res && matchLast)
+  {
+    textlen--;
+    if ((textlen > 0) && (itemlen >= textlen))
+      *matchLast = (lstrcmpniW(itemtext,text,textlen) == 0);
+    else
+      *matchLast = FALSE;
+  }
   if (mustFree) COMCTL32_Free(itemtext);
 
@@ -4859,28 +4869,47 @@
 }
 
-static TREEVIEW_ITEM* TREEVIEW_Search(HWND hwnd,TREEVIEW_INFO *infoPtr,INT iItem,LPWSTR text,INT textlen)
+static TREEVIEW_ITEM* TREEVIEW_Search(HWND hwnd,TREEVIEW_INFO *infoPtr,INT iItem,LPWSTR text,INT textlen,TREEVIEW_ITEM **nearest)
 {
   TREEVIEW_ITEM *item,*start;
-  BOOL found = FALSE;
+  BOOL bMatchLast;
 
   item = start = &infoPtr->items[iItem];
+  if (nearest) *nearest = NULL;
 
   //search start to end
   while (item)
   {
-    if (TREEVIEW_Compare(hwnd,item,text,textlen)) return item;
+    if (nearest)
+    {
+      if (TREEVIEW_Compare(hwnd,item,text,textlen,(!*nearest) ? &bMatchLast:NULL))
+        return item;
+      else if (!*nearest && bMatchLast)
+        *nearest = item;
+    } else
+    {
+      if (TREEVIEW_Compare(hwnd,item,text,textlen,NULL))
+        return item;
+    }
     item = TREEVIEW_GetNextListItem(hwnd,infoPtr,item);
   }
-  if (!found)
-  {
-    iItem = (INT)infoPtr->TopRootItem;
-    item = &infoPtr->items[iItem];
-
-    //search first to start
-    while (item != start)
-    {
-      if (TREEVIEW_Compare(hwnd,item,text,textlen)) return item;
-      item = TREEVIEW_GetNextListItem(hwnd,infoPtr,item);
+
+  iItem = (INT)infoPtr->TopRootItem;
+  item = &infoPtr->items[iItem];
+
+  //search first to start
+  while (item != start)
+  {
+    if (nearest)
+    {
+      if (TREEVIEW_Compare(hwnd,item,text,textlen,(!*nearest) ? &bMatchLast:NULL))
+        return item;
+      else if (!*nearest && bMatchLast)
+        *nearest = item;
+    } else
+    {
+      if (TREEVIEW_Compare(hwnd,item,text,textlen,NULL))
+        return item;
     }
+    item = TREEVIEW_GetNextListItem(hwnd,infoPtr,item);
   }
 
@@ -4888,5 +4917,5 @@
 }
 
-//CB: this method is CPU intense: optimize it and use a secondary thread
+//NOTE: sister function in listview control -> sync changes
 
 static VOID TREEVIEW_ISearch(HWND hwnd,CHAR ch)
@@ -4896,12 +4925,11 @@
   INT len,iItem;
   CHAR ch2[2];
-  TREEVIEW_ITEM *item;
+  TREEVIEW_ITEM *item,*nearest = NULL;
+  DWORD dwISearchTime;
+  BOOL checkNearest = TRUE;
 
   //check timer
-  if (infoPtr->Timer & TV_ISEARCH_TIMER_SET)
-  {
-    KillTimer(hwnd,TV_ISEARCH_TIMER);
-    infoPtr->Timer &= ~TV_ISEARCH_TIMER_SET;
-  } else if (infoPtr->uISearchLen > 0)
+  dwISearchTime = GetTickCount();
+  if ((infoPtr->uISearchLen > 0) && (TICKDIFF(infoPtr->dwISearchTime,dwISearchTime) > TV_ISEARCH_DELAY))
   {
     COMCTL32_Free(infoPtr->pszISearch);
@@ -4919,12 +4947,26 @@
   ch2[1] = 0;
   lstrcpyAtoW((LPWSTR)&newString[len-1],(LPSTR)&ch2);
+  for (INT x = 1;x < len;x++)
+  {
+    if (newString[0] != newString[x])
+    {
+      checkNearest = FALSE;
+      break;
+    }
+  }
 
   //search
 
-  iItem = infoPtr->selectedItem ? (INT)infoPtr->selectedItem:(INT)infoPtr->TopRootItem;
-
+  //start with selected item or root
   if (infoPtr->selectedItem)
   {
+    iItem = (INT)infoPtr->selectedItem;
     item = &infoPtr->items[iItem];
+
+    //check if new string is valid for old selection
+    if (TREEVIEW_Compare(hwnd,item,newString,len,NULL))
+      goto ISearchDone;
+
+    //no match, continue with next item
     item = TREEVIEW_GetNextListItem(hwnd,infoPtr,item);
     if (!item) item = &infoPtr->items[(INT)infoPtr->TopRootItem];
@@ -4932,20 +4974,18 @@
   } else iItem = (INT)infoPtr->TopRootItem;
 
-  item = TREEVIEW_Search(hwnd,infoPtr,iItem,newString,len);
-  if (!item && infoPtr->selectedItem && infoPtr->pszISearch)
-  {
-    TREEVIEW_ITEM *next;
-
-    item = &infoPtr->items[iItem];
-    next = TREEVIEW_Search(hwnd,infoPtr,(INT)item->hItem,infoPtr->pszISearch,infoPtr->uISearchLen);
-    if (next)
-    {
-      TREEVIEW_SelectItem(hwnd,(WPARAM)TVGN_CARET,(LPARAM)next->hItem);
-      TREEVIEW_EnsureVisible(hwnd,next->hItem);
-    }
+  //scan
+  item = TREEVIEW_Search(hwnd,infoPtr,iItem,newString,len,checkNearest ? &nearest:NULL);
+
+  if (!item && nearest)
+  {
+    TREEVIEW_SelectItem(hwnd,(WPARAM)TVGN_CARET,(LPARAM)nearest->hItem);
+    TREEVIEW_EnsureVisible(hwnd,nearest->hItem);
+    infoPtr->dwISearchTime = GetTickCount();
+
     COMCTL32_Free(newString);
     return;
   }
 
+ISearchDone:
   //done
   if (item)
@@ -4956,6 +4996,5 @@
     TREEVIEW_SelectItem(hwnd,(WPARAM)TVGN_CARET,(LPARAM)item->hItem);
     TREEVIEW_EnsureVisible(hwnd,item->hItem);
-    SetTimer(hwnd,TV_ISEARCH_TIMER,TV_ISEARCH_DELAY,0);
-    infoPtr->Timer |= TV_ISEARCH_TIMER_SET;
+    infoPtr->dwISearchTime = GetTickCount();
   } else
   {
