Index: trunk/src/user32/new/makefile
===================================================================
--- trunk/src/user32/new/makefile	(revision 2379)
+++ trunk/src/user32/new/makefile	(revision 2381)
@@ -1,3 +1,3 @@
-# $Id: makefile,v 1.53 2000-01-01 14:59:41 cbratschi Exp $
+# $Id: makefile,v 1.54 2000-01-09 14:14:22 cbratschi Exp $
 
 #
@@ -69,4 +69,5 @@
 $(PDWIN32_LIB)/libuls.lib
 $(PDWIN32_LIB)/odincrt.lib
+$(PDWIN32_LIB)/shell32.lib
 OS2386.LIB
 $(RTLLIB_O)
Index: trunk/src/user32/new/oslibmsg.cpp
===================================================================
--- trunk/src/user32/new/oslibmsg.cpp	(revision 2379)
+++ trunk/src/user32/new/oslibmsg.cpp	(revision 2381)
@@ -1,3 +1,3 @@
-/* $Id: oslibmsg.cpp,v 1.10 2000-01-08 17:08:55 sandervl Exp $ */
+/* $Id: oslibmsg.cpp,v 1.11 2000-01-09 14:14:22 cbratschi Exp $ */
 /*
  * Window message translation functions for OS/2
@@ -241,4 +241,5 @@
     } while (eaten);
   }
+
   OS2ToWinMsgTranslate((PVOID)thdb, &os2msg, pMsg, isUnicode, MSG_REMOVE);
   memcpy(MsgThreadPtr, &os2msg, sizeof(QMSG));
@@ -278,4 +279,5 @@
         return TRUE;
   }
+
 continuepeekmsg:
   do {
Index: trunk/src/user32/new/oslibmsgtranslate.cpp
===================================================================
--- trunk/src/user32/new/oslibmsgtranslate.cpp	(revision 2379)
+++ trunk/src/user32/new/oslibmsgtranslate.cpp	(revision 2381)
@@ -1,3 +1,3 @@
-/* $Id: oslibmsgtranslate.cpp,v 1.8 2000-01-08 17:08:56 sandervl Exp $ */
+/* $Id: oslibmsgtranslate.cpp,v 1.9 2000-01-09 14:14:23 cbratschi Exp $ */
 /*
  * Window message translation functions for OS/2
@@ -144,5 +144,6 @@
   }
   winMsg->time = os2Msg->time;
-  winMsg->pt.x = os2Msg->ptl.x;
+  //CB: PM bug or undocumented feature? ptl.x highword is set!
+  winMsg->pt.x = os2Msg->ptl.x & 0xFFFF;
   winMsg->pt.y = mapScreenY(os2Msg->ptl.y);
 
Index: trunk/src/user32/new/pmframe.cpp
===================================================================
--- trunk/src/user32/new/pmframe.cpp	(revision 2379)
+++ trunk/src/user32/new/pmframe.cpp	(revision 2381)
@@ -1,3 +1,3 @@
-/* $Id: pmframe.cpp,v 1.8 2000-01-08 16:47:47 cbratschi Exp $ */
+/* $Id: pmframe.cpp,v 1.9 2000-01-09 14:14:23 cbratschi Exp $ */
 /*
  * Win32 Frame Managment Code for OS/2
@@ -31,178 +31,4 @@
 //******************************************************************************
 //******************************************************************************
-VOID Draw3DRect(HPS hps,RECTL rect,LONG colorBR,LONG colorTL)
-{
-  POINTL point;
-
-  GpiSetColor(hps,colorBR);
-  point.x = rect.xLeft;
-  point.y = rect.yBottom;
-  GpiMove(hps,&point);
-  point.x = rect.xRight-1;
-  GpiLine(hps,&point);
-  point.y = rect.yTop-1;
-  GpiLine(hps,&point);
-  GpiSetColor(hps,colorTL);
-  point.x--;
-  GpiMove(hps,&point);
-  point.x = rect.xLeft;
-  GpiLine(hps,&point);
-  point.y = rect.yBottom+1;
-  GpiLine(hps,&point);
-}
-//******************************************************************************
-//******************************************************************************
-inline VOID DeflateRect(RECTL *rect)
-{
-  rect->xLeft++;
-  rect->xRight--;
-  rect->yTop--;
-  rect->yBottom++;
-}
-//******************************************************************************
-//******************************************************************************
-VOID DrawFrame(HPS hps,RECTL *rect,Win32BaseWindow *win32wnd)
-{
-  LONG clrWhite,clrBlack,clrDark,clrLight;
-  POINTL point;
-  DWORD dwExStyle = win32wnd->getExStyle();
-  DWORD dwStyle = win32wnd->getStyle();
-
-  //CB: todo: switch to RGB mode and use win colors
-  clrWhite = CLR_WHITE;
-  clrBlack = CLR_BLACK;
-  clrLight = CLR_PALEGRAY;
-  clrDark  = CLR_DARKGRAY;
-
-  if (dwExStyle & WS_EX_CLIENTEDGE_W)
-  {
-    Draw3DRect(hps,*rect,clrWhite,clrDark);
-    DeflateRect(rect);
-    Draw3DRect(hps,*rect,clrLight,clrBlack);
-  }
-  else if (dwExStyle & WS_EX_DLGMODALFRAME_W)
-  {
-    Draw3DRect(hps,*rect,clrBlack,clrLight);
-    DeflateRect(rect);
-    Draw3DRect(hps,*rect,clrDark,clrWhite);
-    DeflateRect(rect);
-    Draw3DRect(hps,*rect,clrLight,clrLight);
-  }
-  else if (dwExStyle & WS_EX_STATICEDGE_W)
-  {
-    Draw3DRect(hps,*rect,clrWhite,clrDark);
-  }
-  else if (dwExStyle & WS_EX_WINDOWEDGE_W);
-  else if (dwStyle & WS_BORDER_W)
-  {
-    Draw3DRect(hps,*rect,clrBlack,clrBlack);
-  }
-
-  DeflateRect(rect);
-}
-//******************************************************************************
-//******************************************************************************
-BOOL CanDrawSizeBox(Win32BaseWindow *win32wnd)
-{
-  return ((win32wnd->getStyle() & WS_SIZEBOX_W) && (WinQueryWindowULong(win32wnd->getOS2FrameWindowHandle(),QWL_STYLE) & FS_SIZEBORDER)
-          && win32wnd->getVertScrollHandle() && WinQueryWindow(win32wnd->getVertScrollHandle(),QW_PARENT) == win32wnd->getOS2FrameWindowHandle()
-          && win32wnd->getHorzScrollHandle() && WinQueryWindow(win32wnd->getHorzScrollHandle(),QW_PARENT) == win32wnd->getOS2FrameWindowHandle());
-}
-//******************************************************************************
-//******************************************************************************
-VOID GetSizeBox(Win32BaseWindow *win32wnd,RECTL *rect)
-{
-  SWP swpHorz,swpVert;
-
-  WinQueryWindowPos(win32wnd->getVertScrollHandle(),&swpVert);
-  WinQueryWindowPos(win32wnd->getHorzScrollHandle(),&swpHorz);
-  rect->xLeft = swpVert.x;
-  rect->xRight = swpVert.x+swpVert.cx;
-  rect->yTop = swpHorz.y+swpHorz.cy;
-  rect->yBottom = swpHorz.y;
-}
-//******************************************************************************
-//******************************************************************************
-BOOL InSizeBox(Win32BaseWindow *win32wnd,POINTS *points)
-{
-  if (CanDrawSizeBox(win32wnd))
-  {
-    RECTL rect;
-    POINTL point;
-
-    point.x = points->x;
-    point.y = points->y;
-    GetSizeBox(win32wnd,&rect);
-    return (WinPtInRect(GetThreadHAB(),&rect,&point));
-  }
-
-  return FALSE;
-}
-//******************************************************************************
-//******************************************************************************
-VOID DrawSizeBox(HPS hps,RECTL rect)
-{
-  POINTL p1,p2;
-  LONG clrDark = CLR_DARKGRAY,clrWhite = CLR_WHITE;
-  INT x;
-
-  //CB: todo: switch to RGB mode and use win colors
-  WinFillRect(hps,&rect,SYSCLR_DIALOGBACKGROUND);
-  p1.x = rect.xRight-2;
-  p1.y = rect.yBottom;
-  p2.x = rect.xRight-1;
-  p2.y = rect.yBottom+1;
-  for (x = 0;x < 3;x++)
-  {
-    GpiSetColor(hps,clrDark);
-    GpiMove(hps,&p1);
-    GpiLine(hps,&p2);
-    p1.x--;
-    p2.y++;
-    GpiMove(hps,&p1);
-    GpiLine(hps,&p2);
-    GpiSetColor(hps,clrWhite);
-    p1.x--;
-    p2.y++;
-    GpiMove(hps,&p1);
-    GpiLine(hps,&p2);
-    p1.x -= 2;
-    p2.y += 2;
-  }
-}
-//******************************************************************************
-//******************************************************************************
-void DrawActivate(Win32BaseWindow *win32wnd, HWND hwnd)
-{
-    if (!win32wnd->isChild())
-    {
-        if (CanDrawSizeBox(win32wnd))
-        {
-          HPS hps;
-          RECTL rect;
-
-          GetSizeBox(win32wnd,&rect);
-          hps = WinGetClipPS(hwnd,0,PSF_CLIPCHILDREN | PSF_CLIPSIBLINGS);
-          DrawSizeBox(hps,rect);
-          WinReleasePS(hps);
-
-        }
-    }
-    else
-    {
-        HPS hps;
-        RECTL rect;
-
-        WinQueryWindowRect(hwnd,&rect);
-        rect.xRight = rect.xRight-rect.xLeft;
-        rect.yTop = rect.yTop-rect.yBottom;
-        rect.xLeft = rect.yBottom = 0;
-        hps = WinGetClipPS(hwnd,0,PSF_CLIPCHILDREN | PSF_CLIPSIBLINGS);
-        DrawFrame(hps,&rect,win32wnd);
-        WinReleasePS(hps);
-    }
-}
-//******************************************************************************
-//******************************************************************************
 VOID FrameTrackFrame(Win32BaseWindow *win32wnd,DWORD flags)
 {
@@ -594,176 +420,6 @@
 }
 
-VOID FrameGetBorderSize(Win32BaseWindow *win32wnd,PWPOINT pSize)
-{
-  WinSendMsg(win32wnd->getOS2FrameWindowHandle(),WM_QUERYBORDERSIZE,(MPARAM)pSize,(MPARAM)0);
-}
-
-VOID FrameSetBorderSize(Win32BaseWindow *win32wnd,BOOL resize)
-{
-  POINTL point;
-
-  if (!resize)
-  {
-    WinSendMsg(win32wnd->getOS2FrameWindowHandle(),WM_SETBORDERSIZE,(MPARAM)win32wnd->getBorderWidth(),(MPARAM)win32wnd->getBorderHeight());
-
-    return;
-  }
-
-  FrameGetBorderSize(win32wnd,&point);
-  WinSendMsg(win32wnd->getOS2FrameWindowHandle(),WM_SETBORDERSIZE,(MPARAM)win32wnd->getBorderWidth(),(MPARAM)win32wnd->getBorderHeight());
-  if ((point.x != win32wnd->getBorderWidth()) || (point.y != win32wnd->getBorderHeight()))
-  {
-    INT xDiff = win32wnd->getBorderWidth()-point.x;
-    INT yDiff = win32wnd->getBorderHeight()-point.y;
-    SWP swp;
-
-    WinQueryWindowPos(win32wnd->getOS2FrameWindowHandle(),&swp);
-    swp.x  += xDiff;
-    swp.y  += yDiff;
-    swp.cx -= 2*xDiff;
-    swp.cy -= 2*yDiff;
-    WinSetWindowPos(win32wnd->getOS2FrameWindowHandle(),0,swp.x,swp.y,swp.cx,swp.cy,SWP_MOVE | SWP_SIZE);
-  }
-}
-
-UINT FrameGetDefSizeBorderSize(VOID)
-{
-  return WinQuerySysValue(HWND_DESKTOP,SV_CXSIZEBORDER);
-}
-
-BOOL FrameCreateScrollBars(Win32BaseWindow *win32wnd,BOOL createHorz,BOOL createVert,BOOL updateFrame,DWORD *flags)
-{
-  HWND hwndHScroll = 0,hwndVScroll = 0;
-  ULONG updateFlags = 0;
-
-  if (createHorz)
-  {
-    hwndHScroll = WinCreateWindow(win32wnd->getOS2FrameWindowHandle(),WC_SCROLLBAR,"",WS_VISIBLE | WS_PARENTCLIP | WS_SYNCPAINT | SBS_HORZ,0,0,0,0,win32wnd->getOS2FrameWindowHandle(),HWND_TOP,FID_HORZSCROLL,NULL,NULL);
-    if (hwndHScroll) win32wnd->setHorzScrollHandle(hwndHScroll);
-    else return FALSE;
-    updateFlags = FCF_HORZSCROLL;
-  }
-
-  if (createVert)
-  {
-    hwndVScroll = WinCreateWindow(win32wnd->getOS2FrameWindowHandle(),WC_SCROLLBAR,"",WS_VISIBLE | WS_PARENTCLIP | WS_SYNCPAINT | SBS_VERT,0,0,0,0,win32wnd->getOS2FrameWindowHandle(),HWND_TOP,FID_VERTSCROLL,NULL,NULL);
-    if (hwndVScroll) win32wnd->setVertScrollHandle(hwndVScroll); else
-    {
-      if (hwndHScroll) WinDestroyWindow(hwndHScroll);
-
-      return FALSE;
-    }
-    updateFlags |= FCF_VERTSCROLL;
-  }
-
-  win32wnd->subclassScrollBars(hwndHScroll,hwndVScroll);
-
-  if (updateFrame && updateFlags) WinSendMsg(win32wnd->getOS2FrameWindowHandle(),WM_UPDATEFRAME,(MPARAM)0,(MPARAM)0);
-  if (flags) *flags = updateFlags;
-
-  return TRUE;
-}
-
-VOID FrameGetScrollBarHandles(Win32BaseWindow *win32wnd,BOOL getHorz,BOOL getVert)
-{
-  if (getHorz) win32wnd->setHorzScrollHandle(WinWindowFromID(win32wnd->getOS2FrameWindowHandle(),FID_HORZSCROLL));
-  if (getVert) win32wnd->setVertScrollHandle(WinWindowFromID(win32wnd->getOS2FrameWindowHandle(),FID_VERTSCROLL));
-}
-
-BOOL FrameShowScrollBars(Win32BaseWindow *win32wnd,BOOL changeHorz,BOOL changeVert,BOOL fShow,BOOL updateFrame,DWORD *flags)
-{
-  HWND hwndObj = WinQueryObjectWindow(HWND_DESKTOP);
-  ULONG updateFlags = 0;
-
-  if (changeHorz)
-  {
-    HWND hwndCurPar = WinQueryWindow(win32wnd->getHorzScrollHandle(),QW_PARENT);
-
-    if ((fShow && (hwndCurPar == hwndObj)) || (!fShow && (hwndCurPar != hwndObj)))
-    {
-      WinSetParent(win32wnd->getHorzScrollHandle(),fShow ? win32wnd->getOS2FrameWindowHandle():HWND_OBJECT,FALSE);
-      updateFlags |= FCF_HORZSCROLL;
-    }
-  }
-
-  if (changeVert)
-  {
-    HWND hwndCurPar = WinQueryWindow(win32wnd->getVertScrollHandle(),QW_PARENT);
-
-    if ((fShow && (hwndCurPar == hwndObj)) || (!fShow && (hwndCurPar != hwndObj)))
-    {
-      WinSetParent(win32wnd->getVertScrollHandle(),fShow ? win32wnd->getOS2FrameWindowHandle():HWND_OBJECT,FALSE);
-      updateFlags |= FCF_VERTSCROLL;
-    }
-  }
-
-  if (updateFrame && updateFlags) WinSendMsg(win32wnd->getOS2FrameWindowHandle(),WM_UPDATEFRAME,(MPARAM)updateFlags,(MPARAM)0);
-  if (flags) *flags = updateFlags;
-
-  return TRUE;
-}
-
 VOID FrameUpdateFrame(Win32BaseWindow *win32wnd,DWORD flags)
 {
   WinSendMsg(win32wnd->getOS2FrameWindowHandle(),WM_UPDATEFRAME,(MPARAM)flags,(MPARAM)0);
 }
-
-DWORD FrameHitTest(Win32BaseWindow *win32wnd,INT x,INT y)
-{
-  POINTL point;
-  HWND hwnd = win32wnd->getOS2FrameWindowHandle(),child;
-
-  if (hwnd == win32wnd->getOS2WindowHandle()) return HTCLIENT_W;
-  if (win32wnd->getOS2WindowHandle() == WinQueryCapture(HWND_DESKTOP)) return HTCLIENT_W;
-  point.x = x;
-  point.y = mapScreenY(y);
-  WinMapWindowPoints(HWND_DESKTOP,hwnd,&point,1);
-  child = WinWindowFromPoint(hwnd,&point,FALSE);
-
-  if (child == 0) return HTERROR_W;
-  if (child == win32wnd->getOS2FrameWindowHandle())
-  {
-    RECTL client,frame;
-
-    if (CanDrawSizeBox(win32wnd))
-    {
-      RECTL rect;
-
-      GetSizeBox(win32wnd,&rect);
-      if (WinPtInRect(GetThreadHAB(),&rect,&point)) return HTGROWBOX_W;
-    }
-    //somewhere in the border
-    INT w = WinQuerySysValue(HWND_DESKTOP,SV_CXMINMAXBUTTON);
-    INT h = WinQuerySysValue(HWND_DESKTOP,SV_CXMINMAXBUTTON);
-    WinQueryWindowRect(hwnd,&frame);
-
-    if (point.y < h)
-    {
-      if (point.x < w) return HTBOTTOMLEFT_W;
-      if (point.x > frame.xRight-1-w) return HTBOTTOMRIGHT_W;
-      return HTBOTTOM_W;
-    }
-    if (point.y > frame.yTop-1-h)
-    {
-      if (point.x < w) return HTTOPLEFT_W;
-      if (point.x > frame.xRight-1-w) return HTTOPRIGHT_W;
-      return HTTOP_W;
-    }
-    return HTBORDER_W;
-  } else
-  {
-    if (child == WinWindowFromID(hwnd,FID_CLIENT)) return HTCLIENT_W;
-    if (child == WinWindowFromID(hwnd,FID_VERTSCROLL)) return HTVSCROLL_W;
-    if (child == WinWindowFromID(hwnd,FID_HORZSCROLL)) return HTHSCROLL_W;
-    if (child == WinWindowFromID(hwnd,FID_SYSMENU)) return HTSYSMENU_W;
-    if (child == WinWindowFromID(hwnd,FID_TITLEBAR)) return HTCAPTION_W;
-    if (child == WinWindowFromID(hwnd,FID_MENU)) return HTMENU_W;
-    if (child == WinWindowFromID(hwnd,FID_MINMAX))
-    {
-      //CB: close, reduce or zoom
-      return HTZOOM_W;
-    }
-
-    return HTERROR_W;
-  }
-}
Index: trunk/src/user32/new/pmframe.h
===================================================================
--- trunk/src/user32/new/pmframe.h	(revision 2379)
+++ trunk/src/user32/new/pmframe.h	(revision 2381)
@@ -1,3 +1,3 @@
-/* $Id: pmframe.h,v 1.2 2000-01-08 16:47:48 cbratschi Exp $ */
+/* $Id: pmframe.h,v 1.3 2000-01-09 14:14:23 cbratschi Exp $ */
 /*
  * Win32 Frame Managment Code for OS/2
@@ -10,10 +10,4 @@
 
 PVOID FrameSubclassFrameWindow(Win32BaseWindow *win32wnd);
-VOID  FrameSetBorderSize(Win32BaseWindow *win32wnd,BOOL resize);
-UINT  FrameGetDefSizeBorderSize(VOID);
-VOID  FrameTrackFrame(Win32BaseWindow *win32wnd,BOOL lefttop);
-BOOL  FrameCreateScrollBars(Win32BaseWindow *win32wnd,BOOL createHorz,BOOL createVert,BOOL updateFrame,DWORD *flags = NULL);
-VOID  FrameGetScrollBarHandles(Win32BaseWindow *win32wnd,BOOL getHorz,BOOL getVert);
-BOOL  FrameShowScrollBars(Win32BaseWindow *win32wnd,BOOL changeHorz,BOOL changeVert,BOOL fShow,BOOL updateFrame,DWORD *flags = NULL);
 VOID  FrameUpdateFrame(Win32BaseWindow *win32wnd,DWORD flags);
 
@@ -48,6 +42,4 @@
 #define HTSIZELAST_W          HTBOTTOMRIGHT_W
 
-DWORD FrameHitTest(Win32BaseWindow *win32wnd,INT x,INT y);
-
 #define TFOS_LEFT                    0x0001
 #define TFOS_TOP                     0x0002
Index: trunk/src/user32/new/scroll.cpp
===================================================================
--- trunk/src/user32/new/scroll.cpp	(revision 2379)
+++ trunk/src/user32/new/scroll.cpp	(revision 2381)
@@ -1,3 +1,3 @@
-/* $Id: scroll.cpp,v 1.7 2000-01-01 14:57:22 cbratschi Exp $ */
+/* $Id: scroll.cpp,v 1.8 2000-01-09 14:14:23 cbratschi Exp $ */
 /*
  * Scrollbar control
@@ -73,39 +73,4 @@
 static BOOL SCROLL_MovingThumb = FALSE;
 
-// Get the scrollbar handle: works only with frame/control handles
-
-static HWND SCROLL_GetScrollHandle(HWND hwnd,INT nBar)
-{
-  switch(nBar)
-  {
-    case SB_HORZ:
-    case SB_VERT:
-      {
-        Win32BaseWindow *win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
-
-        if (!win32wnd) return 0;
-//CB: I removed WS_* check due to problems, but it should work
-        if (nBar == SB_HORZ)
-          return /*(win32wnd->getStyle() & WS_HSCROLL) ?*/ Win32BaseWindow::OS2ToWin32Handle(win32wnd->getHorzScrollHandle())/*:0*/;
-        else
-          return /*(win32wnd->getStyle() & WS_VSCROLL) ?*/ Win32BaseWindow::OS2ToWin32Handle(win32wnd->getVertScrollHandle())/*:0*/;
-      }
-
-    case SB_CTL:
-      return hwnd;
-
-    default:
-      return 0;
-  }
-}
-
-static HWND SCROLL_GetFrameHandle(HWND hwnd)
-{
-  Win32BaseWindow *win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
-
-  if (!win32wnd) return 0;
-  return Win32BaseWindow::GetWindowFromOS2FrameHandle(OSLibWinQueryWindow(win32wnd->getOS2WindowHandle(),QWOS_OWNER))->getWindowHandle();
-}
-
 // Get the infoPtr: works only with scrollbar handles
 
@@ -120,7 +85,4 @@
         case SB_VERT:
           win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
-          if (!win32wnd) return NULL;
-          hwndFrame = OSLibWinQueryWindow(win32wnd->getOS2WindowHandle(),QWOS_OWNER);
-          win32wnd = Win32BaseWindow::GetWindowFromOS2FrameHandle(hwndFrame);
           if (!win32wnd) return NULL;
           return win32wnd->getScrollInfo(nBar);
@@ -157,17 +119,55 @@
     {
       case SB_HORZ:
+      {
+        Win32BaseWindow *win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
+        RECT rectClient;
+
+        if (!win32wnd) return FALSE;
+        rectClient = *win32wnd->getClientRectPtr();
+        mapWin32Rect(win32wnd->getParent() ? win32wnd->getParent()->getOS2WindowHandle():OSLIB_HWND_DESKTOP,win32wnd->getOS2FrameWindowHandle(),&rectClient);
+        lprect->left   = rectClient.left;
+        lprect->top    = rectClient.bottom;
+        lprect->right  = rectClient.right;
+        lprect->bottom = lprect->top+GetSystemMetrics(SM_CYHSCROLL);
+        if (win32wnd->getStyle() & WS_BORDER)
+        {
+          lprect->left--;
+          lprect->right++;
+        } else if (win32wnd->getStyle() & WS_VSCROLL)
+            lprect->right++;
+        vertical = FALSE;
+        break;
+      }
+
       case SB_VERT:
+      {
+        Win32BaseWindow *win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
+        RECT rectClient;
+
+        if (!win32wnd) return FALSE;
+        rectClient = *win32wnd->getClientRectPtr();
+        mapWin32Rect(win32wnd->getParent() ? win32wnd->getParent()->getOS2WindowHandle():OSLIB_HWND_DESKTOP,win32wnd->getOS2FrameWindowHandle(),&rectClient);
+        lprect->left   = rectClient.right;
+        lprect->top    = rectClient.top;
+        lprect->right  = lprect->left+GetSystemMetrics(SM_CXVSCROLL);
+        lprect->bottom = rectClient.bottom;
+        if(win32wnd->getStyle() & WS_BORDER)
+        {
+          lprect->top--;
+          lprect->bottom++;
+        } else if (win32wnd->getStyle() & WS_HSCROLL)
+          lprect->bottom++;
+        vertical = TRUE;
+        break;
+      }
+
+      case SB_CTL:
+      {
+        DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE);
+
         GetClientRect( hwnd, lprect );
-        vertical = (nBar == SB_VERT);
+        vertical = ((dwStyle & SBS_VERT) != 0);
         break;
-
-      case SB_CTL:
-        {
-          DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE);
-
-          GetClientRect( hwnd, lprect );
-          vertical = ((dwStyle & SBS_VERT) != 0);
-          break;
-        }
+      }
 
     default:
@@ -566,6 +566,5 @@
  * Redraw the whole scrollbar.
  */
-void SCROLL_DrawScrollBar( HWND hwnd, HDC hdc, INT nBar,
-                           BOOL arrows, BOOL interior )
+void SCROLL_DrawScrollBar(HWND hwnd,HDC hdc,INT nBar,BOOL arrows,BOOL interior)
 {
     INT arrowSize, thumbSize, thumbPos;
@@ -584,5 +583,5 @@
         HBRUSH hBrush;
 
-        hdc = GetDC(hwnd);
+        hdc = GetDCEx(hwnd,0,DCX_CACHE | ((nBar == SB_CTL) ? 0 : DCX_WINDOW));
         hBrush = GetSysColorBrush(COLOR_3DFACE);
         GetClientRect(hwnd,&rect);
@@ -635,14 +634,10 @@
                                      BOOL arrows, BOOL interior )
 {
-  Win32BaseWindow *window;
-  HDC hdc;
-
-
-    hdc = GetDC(hwnd);
-
-    if (!hdc) return;
-
-    SCROLL_DrawScrollBar( hwnd, hdc, nBar, arrows, interior );
-    ReleaseDC( hwnd, hdc );
+  HDC hdc = GetDCEx(hwnd,0,DCX_CACHE | ((nBar == SB_CTL) ? 0:DCX_WINDOW));
+
+  if (!hdc) return;
+
+  SCROLL_DrawScrollBar( hwnd, hdc, nBar, arrows, interior );
+  ReleaseDC( hwnd, hdc );
 }
 
@@ -763,16 +758,5 @@
 
     vertical = SCROLL_GetScrollBarRect(hwnd,nBar,&rect,&arrowSize,&thumbSize,&thumbPos);
-    if (nBar == SB_CTL) hwndOwner = GetParent(hwnd); else
-    {
-      Win32BaseWindow *win32wnd;
-      HWND hwndFrame;
-
-      win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
-      if (!win32wnd) return res;
-      hwndFrame = OSLibWinQueryWindow(win32wnd->getOS2WindowHandle(),QWOS_OWNER);
-      win32wnd = Win32BaseWindow::GetWindowFromOS2FrameHandle(hwndFrame);
-      if (!win32wnd) return res;
-      hwndOwner = win32wnd->getWindowHandle();
-    }
+    hwndOwner = (nBar == SB_CTL) ? GetParent(hwnd):hwnd;
 
     hwndCtl = (nBar == SB_CTL) ? hwnd:0;
@@ -795,5 +779,5 @@
         if ((SCROLL_FocusWin == hwnd) && SCROLL_Highlighted)
         {
-          hdc = GetDC(hwnd);
+          hdc = GetDCEx(hwnd,0,DCX_CACHE | ((nBar == SB_CTL) ? 0:DCX_WINDOW));
           SCROLL_DrawScrollBar(hwnd,hdc,nBar,FALSE,TRUE);
           ReleaseDC(hwnd,hdc);
@@ -854,5 +838,5 @@
           {
             SCROLL_Highlighted = FALSE;
-            hdc = GetDC(hwnd);
+            hdc = GetDCEx(hwnd,0,DCX_CACHE | ((nBar == SB_CTL) ? 0:DCX_WINDOW));
             SCROLL_DrawScrollBar(hwnd,hdc,nBar,FALSE,TRUE);
             ReleaseDC(hwnd,hdc);
@@ -873,5 +857,5 @@
           if (!SCROLL_Scrolling)
           {
-            hdc = GetDC(hwnd);
+            hdc = GetDCEx(hwnd,0,DCX_CACHE | ((nBar == SB_CTL) ? 0 : DCX_WINDOW));
             SCROLL_DrawScrollBar(hwnd,hdc,nBar,FALSE,TRUE);
             ReleaseDC(hwnd,hdc);
@@ -884,5 +868,5 @@
     }
 
-    hdc = GetDC(hwnd);
+    hdc = GetDCEx(hwnd,0,DCX_CACHE | ((nBar == SB_CTL) ? 0 : DCX_WINDOW));
 
     switch(SCROLL_trackHitTest)
@@ -1103,5 +1087,5 @@
   INT oldPos = infoPtr->CurVal;
 
-  SetScrollRange((nBar == SB_CTL) ? hwnd:SCROLL_GetFrameHandle(hwnd),nBar,wParam,lParam,redraw);
+  SetScrollRange(hwnd,nBar,wParam,lParam,redraw);
   return (oldPos != infoPtr->CurVal) ? infoPtr->CurVal:0;
 }
@@ -1189,122 +1173,4 @@
 }
 
-/* frame handlers */
-
-VOID SCROLL_SubclassScrollBars(HWND hwndHorz,HWND hwndVert)
-{
-  if (hwndHorz) SetWindowLongA(hwndHorz,GWL_WNDPROC,(ULONG)HorzScrollBarWndProc);
-  if (hwndVert) SetWindowLongA(hwndVert,GWL_WNDPROC,(ULONG)VertScrollBarWndProc);
-}
-
-LRESULT WINAPI HorzScrollBarWndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam )
-{
-  switch (message)
-  {
-    case WM_LBUTTONDOWN:
-    case WM_LBUTTONUP:
-    case WM_NCHITTEST:
-    case WM_CAPTURECHANGED:
-    case WM_MOUSEMOVE:
-    case WM_SYSTIMER:
-    case WM_SETFOCUS:
-    case WM_KILLFOCUS:
-      return SCROLL_HandleScrollEvent(hwnd,wParam,lParam,SB_HORZ,message);
-
-    case WM_ERASEBKGND:
-      return 1;
-
-    case WM_GETDLGCODE:
-      return DLGC_WANTARROWS; /* Windows returns this value */
-
-    case WM_PAINT:
-      return SCROLL_Paint(hwnd,wParam,lParam,SB_HORZ);
-
-    case SBM_SETPOS:
-      return SetScrollPos(SCROLL_GetFrameHandle(hwnd),SB_HORZ,wParam,(BOOL)lParam);
-
-    case SBM_GETPOS:
-      return GetScrollPos(SCROLL_GetFrameHandle(hwnd),SB_HORZ);
-
-    case SBM_SETRANGE:
-      return SCROLL_SetRange(hwnd,wParam,lParam,SB_HORZ,FALSE);
-
-    case SBM_GETRANGE:
-      GetScrollRange(SCROLL_GetFrameHandle(hwnd),SB_HORZ,(LPINT)wParam,(LPINT)lParam);
-      return 0;
-
-    case SBM_ENABLE_ARROWS:
-      return EnableScrollBar(SCROLL_GetFrameHandle(hwnd),SB_HORZ,wParam);
-
-    case SBM_SETRANGEREDRAW:
-      return SCROLL_SetRange(hwnd,wParam,lParam,SB_HORZ,TRUE);
-
-    case SBM_SETSCROLLINFO:
-      return SetScrollInfo(SCROLL_GetFrameHandle(hwnd),SB_HORZ,(SCROLLINFO*)lParam,wParam);
-
-    case SBM_GETSCROLLINFO:
-      return GetScrollInfo(SCROLL_GetFrameHandle(hwnd),SB_HORZ,(SCROLLINFO*)lParam);
-
-    default:
-      return DefWindowProcA(hwnd,message,wParam,lParam);
-  }
-
-  return 0;
-}
-
-LRESULT WINAPI VertScrollBarWndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam )
-{
-  switch (message)
-  {
-    case WM_LBUTTONDOWN:
-    case WM_LBUTTONUP:
-    case WM_NCHITTEST:
-    case WM_CAPTURECHANGED:
-    case WM_MOUSEMOVE:
-    case WM_SYSTIMER:
-    case WM_SETFOCUS:
-    case WM_KILLFOCUS:
-      return SCROLL_HandleScrollEvent(hwnd,wParam,lParam,SB_VERT,message);
-
-    case WM_ERASEBKGND:
-      return 1;
-
-    case WM_GETDLGCODE:
-      return DLGC_WANTARROWS; /* Windows returns this value */
-
-    case WM_PAINT:
-      return SCROLL_Paint(hwnd,wParam,lParam,SB_VERT);
-
-    case SBM_SETPOS:
-      return SetScrollPos(SCROLL_GetFrameHandle(hwnd),SB_VERT,wParam,(BOOL)lParam);
-
-    case SBM_GETPOS:
-      return GetScrollPos(SCROLL_GetFrameHandle(hwnd),SB_VERT);
-
-    case SBM_SETRANGE:
-      return SCROLL_SetRange(hwnd,wParam,lParam,SB_VERT,FALSE);
-
-    case SBM_GETRANGE:
-      GetScrollRange(SCROLL_GetFrameHandle(hwnd),SB_VERT,(LPINT)wParam,(LPINT)lParam);
-      return 0;
-
-    case SBM_ENABLE_ARROWS:
-      return EnableScrollBar(SCROLL_GetFrameHandle(hwnd),SB_VERT,wParam);
-
-    case SBM_SETRANGEREDRAW:
-      return SCROLL_SetRange(hwnd,wParam,lParam,SB_VERT,TRUE);
-
-    case SBM_SETSCROLLINFO:
-      return SetScrollInfo(SCROLL_GetFrameHandle(hwnd),SB_VERT,(SCROLLINFO*)lParam,wParam);
-
-    case SBM_GETSCROLLINFO:
-      return GetScrollInfo(SCROLL_GetFrameHandle(hwnd),SB_VERT,(SCROLLINFO*)lParam);
-
-    default:
-      return DefWindowProcA(hwnd,message,wParam,lParam);
-  }
-
-  return 0;
-}
-
 /* Scrollbar API */
 
@@ -1331,10 +1197,8 @@
     UINT new_flags;
     INT action = 0;
-    HWND hwndScroll = SCROLL_GetScrollHandle(hwnd,nBar);
 
     dprintf(("USER32: SetScrollInfo"));
 
-    if (!hwndScroll) return 0;
-    if (!(infoPtr = SCROLL_GetInfoPtr(hwndScroll,nBar))) return 0;
+    if (!(infoPtr = SCROLL_GetInfoPtr(hwnd,nBar))) return 0;
     if (info->fMask & ~(SIF_ALL | SIF_DISABLENOSCROLL)) return 0;
     if ((info->cbSize != sizeof(*info)) &&
@@ -1445,11 +1309,11 @@
         {
           if (action & SA_SSI_REFRESH)
-            SCROLL_RefreshScrollBar(hwndScroll,nBar,TRUE,TRUE);
+            SCROLL_RefreshScrollBar(hwnd,nBar,TRUE,TRUE);
           else
           {
             if (action & (SA_SSI_REPAINT_INTERIOR | SA_SSI_MOVE_THUMB))
-              SCROLL_RefreshScrollBar(hwndScroll,nBar,FALSE,TRUE);
+              SCROLL_RefreshScrollBar(hwnd,nBar,FALSE,TRUE);
             if (action & SA_SSI_REPAINT_ARROWS)
-              SCROLL_RefreshScrollBar(hwndScroll,nBar,TRUE,FALSE);
+              SCROLL_RefreshScrollBar(hwnd,nBar,TRUE,FALSE);
           }
         }
@@ -1473,10 +1337,8 @@
 {
   SCROLLBAR_INFO *infoPtr;
-  HWND hwndScroll;
 
     dprintf(("USER32: GetScrollInfo"));
 
-    hwndScroll = SCROLL_GetScrollHandle(hwnd,nBar);
-    if (!hwndScroll || !(infoPtr = SCROLL_GetInfoPtr(hwndScroll,nBar))) return FALSE;
+    if (!(infoPtr = SCROLL_GetInfoPtr(hwnd,nBar))) return FALSE;
     if (info->fMask & ~(SIF_ALL | SIF_DISABLENOSCROLL)) return FALSE;
     if ((info->cbSize != sizeof(*info)) &&
@@ -1486,5 +1348,5 @@
     if (info->fMask & SIF_POS) info->nPos = infoPtr->CurVal;
     if ((info->fMask & SIF_TRACKPOS) && (info->cbSize == sizeof(*info)))
-      info->nTrackPos = (SCROLL_MovingThumb && SCROLL_TrackingWin == hwndScroll && SCROLL_TrackingBar == nBar) ? SCROLL_TrackingVal:infoPtr->CurVal;
+      info->nTrackPos = (SCROLL_MovingThumb && SCROLL_TrackingWin == hwnd && SCROLL_TrackingBar == nBar) ? SCROLL_TrackingVal:infoPtr->CurVal;
 
     if (info->fMask & SIF_RANGE)
@@ -1517,5 +1379,5 @@
 
     dprintf(("SetScrollPos %x %d %d %d", hwnd, nBar, nPos, bRedraw));
-    if (!(infoPtr = SCROLL_GetInfoPtr(SCROLL_GetScrollHandle(hwnd,nBar),nBar))) return 0;
+    if (!(infoPtr = SCROLL_GetInfoPtr(hwnd,nBar))) return 0;
     oldPos      = infoPtr->CurVal;
     info.cbSize = sizeof(info);
@@ -1544,5 +1406,5 @@
     dprintf(("GetScrollPos %x %d", hwnd, nBar));
 
-    infoPtr = SCROLL_GetInfoPtr(SCROLL_GetScrollHandle(hwnd,nBar),nBar);
+    infoPtr = SCROLL_GetInfoPtr(hwnd,nBar);
     if (!infoPtr) return 0;
 
@@ -1586,5 +1448,5 @@
   SCROLLBAR_INFO *infoPtr;
 
-    infoPtr = SCROLL_GetInfoPtr(SCROLL_GetScrollHandle(hwnd,nBar),nBar);
+    infoPtr = SCROLL_GetInfoPtr(hwnd,nBar);
     if (!infoPtr)
     {
@@ -1608,24 +1470,58 @@
                     BOOL fShow  /* [I] TRUE = show, FALSE = hide  */)
 {
+    Win32BaseWindow *win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
+    BOOL fShowH = (nBar == SB_HORZ) ? 0:fShow,fShowV = (nBar == SB_VERT) ? 0:fShow;
+
     dprintf(("ShowScrollBar %04x %d %d\n", hwnd, nBar, fShow));
-
-    if (nBar == SB_CTL)
-    {
-      ShowWindow(hwnd,fShow ? SW_SHOW:SW_HIDE);
-
-      return TRUE;
-    } else
-    {
-      Win32BaseWindow *window = Win32BaseWindow::GetWindowFromHandle(hwnd);
-      BOOL createHorz = FALSE,createVert = FALSE;
-
-      if (!window)
-      {
-        dprintf(("ShowScrollBar window not found!"));
-        SetLastError(ERROR_INVALID_WINDOW_HANDLE);
-        return FALSE;
-      }
-
-      return window->showScrollBars(nBar == SB_HORZ || nBar == SB_BOTH,nBar == SB_VERT || nBar == SB_BOTH,fShow);
+    if (!win32wnd) return FALSE;
+
+    switch(nBar)
+    {
+     case SB_CTL:
+       ShowWindow(hwnd,fShow ? SW_SHOW:SW_HIDE);
+       return TRUE;
+
+      case SB_BOTH:
+      case SB_HORZ:
+        if (fShow)
+        {
+            fShowH = !(win32wnd->getStyle() & WS_HSCROLL);
+            win32wnd->setStyle(win32wnd->getStyle() | WS_HSCROLL);
+        }
+        else  /* hide it */
+        {
+            fShowH = (win32wnd->getStyle() & WS_HSCROLL);
+            win32wnd->setStyle(win32wnd->getStyle() & ~WS_HSCROLL);
+        }
+        if( nBar == SB_HORZ )
+        {
+            fShowV = FALSE;
+            break;
+        }
+        /* fall through */
+
+    case SB_VERT:
+        if (fShowV)
+        {
+            fShowV = !(win32wnd->getStyle() & WS_VSCROLL);
+            win32wnd->setStyle(win32wnd->getStyle() | WS_VSCROLL);
+        }
+        else  /* hide it */
+        {
+            fShowV = (win32wnd->getStyle() & WS_VSCROLL);
+            win32wnd->setStyle(win32wnd->getStyle() & ~WS_VSCROLL);
+        }
+        if ( nBar == SB_VERT )
+           fShowH = FALSE;
+        break;
+
+    default:
+        return TRUE;  /* Nothing to do! */
+    }
+
+    if( fShowH || fShowV ) /* frame has been changed, let the window redraw itself */
+    {
+        SetWindowPos( hwnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE
+                    | SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED );
     }
 
@@ -1638,73 +1534,30 @@
 BOOL WINAPI EnableScrollBar( HWND hwnd, INT nBar, UINT flags)
 {
-  Win32BaseWindow *window;
-  SCROLLBAR_INFO *infoPtr;
-
-  dprintf(("EnableScrollBar %04x %d %d\n", hwnd, nBar, flags));
-
-  if (nBar == SB_CTL)
-  {
-    if (!(infoPtr = SCROLL_GetInfoPtr(hwnd,nBar))) return FALSE;
-
-    if (infoPtr->flags != flags)
-    {
-      infoPtr->flags = flags;
-      SCROLL_RefreshScrollBar(hwnd,nBar,TRUE,TRUE);
-    }
-
+    BOOL bFineWithMe;
+    SCROLLBAR_INFO *infoPtr;
+
+    dprintf(("EnableScrollBar %04x %d %d\n", hwnd, nBar, flags));
+
+    flags &= ESB_DISABLE_BOTH;
+
+    if (nBar == SB_BOTH)
+    {
+        if (!(infoPtr = SCROLL_GetInfoPtr( hwnd, SB_VERT ))) return FALSE;
+        if (!(bFineWithMe = (infoPtr->flags == flags)) )
+        {
+            infoPtr->flags = flags;
+            SCROLL_RefreshScrollBar( hwnd, SB_VERT, TRUE, TRUE );
+        }
+        nBar = SB_HORZ;
+    }
+    else
+        bFineWithMe = TRUE;
+
+    if (!(infoPtr = SCROLL_GetInfoPtr( hwnd, nBar ))) return FALSE;
+    if (bFineWithMe && infoPtr->flags == flags) return FALSE;
+    infoPtr->flags = flags;
+
+    SCROLL_RefreshScrollBar( hwnd, nBar, TRUE, TRUE );
     return TRUE;
-  } else
-  {
-    Win32BaseWindow *window = Win32BaseWindow::GetWindowFromHandle(hwnd);
-
-    if(!window)
-    {
-      dprintf(("EnableScrollBar window not found!"));
-      SetLastError(ERROR_INVALID_WINDOW_HANDLE);
-      return FALSE;
-    }
-
-    if(window->getStyle() & (WS_HSCROLL | WS_VSCROLL))
-    {
-      BOOL rc = FALSE;
-
-      if (((nBar == SB_VERT) || (nBar == SB_BOTH)) && (window->getStyle() & WS_VSCROLL))
-      {
-        HWND hwndScroll =  Win32BaseWindow::OS2ToWin32Handle(window->getVertScrollHandle());
-
-        infoPtr = SCROLL_GetInfoPtr(hwndScroll,SB_VERT);
-        if (infoPtr)
-        {
-          if (infoPtr->flags != flags)
-          {
-            infoPtr->flags = flags;
-            SCROLL_RefreshScrollBar(hwndScroll,nBar,TRUE,TRUE);
-          }
-
-          rc = TRUE;
-        }
-      }
-      if (((nBar == SB_HORZ) || (rc && (nBar == SB_BOTH))) && (window->getStyle() & WS_HSCROLL))
-      {
-        HWND hwndScroll =  Win32BaseWindow::OS2ToWin32Handle(window->getHorzScrollHandle());
-
-        infoPtr = SCROLL_GetInfoPtr(hwndScroll,SB_VERT);
-        if (infoPtr)
-        {
-          if (infoPtr->flags != flags)
-          {
-            infoPtr->flags = flags;
-            SCROLL_RefreshScrollBar(hwndScroll,nBar,TRUE,TRUE);
-          }
-
-          rc = TRUE;
-        }
-      }
-
-      return rc;
-    }
-  }
-
-  return TRUE;
 }
 
@@ -1720,5 +1573,4 @@
   }
 
-  HWND hwndScroll;
   INT nBar,arrowSize;
 
@@ -1727,15 +1579,12 @@
     case OBJID_CLIENT:
       nBar = SB_CTL;
-      hwndScroll = hwnd;
       break;
 
     case OBJID_HSCROLL:
       nBar = SB_HORZ;
-      hwndScroll = SCROLL_GetScrollHandle(hwnd,SB_HORZ);
       break;
 
     case OBJID_VSCROLL:
       nBar = SB_VERT;
-      hwndScroll = SCROLL_GetScrollHandle(hwnd,SB_VERT);
       break;
 
@@ -1744,10 +1593,8 @@
   }
 
-  if (!hwndScroll) return FALSE;
-
-  SCROLL_GetScrollBarRect(hwndScroll,nBar,&psbi->rcScrollBar,&arrowSize,&psbi->dxyLineButton,&psbi->xyThumbTop);
+  SCROLL_GetScrollBarRect(hwnd,nBar,&psbi->rcScrollBar,&arrowSize,&psbi->dxyLineButton,&psbi->xyThumbTop);
   psbi->xyThumbBottom = psbi->xyThumbTop+psbi->dxyLineButton;
   psbi->bogus = 0; //CB: undocumented!
-  psbi->rgstate[0] = IsWindowVisible(hwndScroll) ? STATE_SYSTEM_INVISIBLE:0;
+  psbi->rgstate[0] = IsWindowVisible(hwnd) ? STATE_SYSTEM_INVISIBLE:0;
   psbi->rgstate[1] = psbi->rgstate[2] = psbi->rgstate[3] = psbi->rgstate[4] = psbi->rgstate[5] = psbi->rgstate[0]; //CB: todo
 
Index: trunk/src/user32/new/win32wbase.cpp
===================================================================
--- trunk/src/user32/new/win32wbase.cpp	(revision 2379)
+++ trunk/src/user32/new/win32wbase.cpp	(revision 2381)
@@ -1,3 +1,3 @@
-/* $Id: win32wbase.cpp,v 1.25 2000-01-08 16:47:48 cbratschi Exp $ */
+/* $Id: win32wbase.cpp,v 1.26 2000-01-09 14:14:24 cbratschi Exp $ */
 /*
  * Win32 Window Base Class for OS/2
@@ -44,6 +44,10 @@
 #include "winmouse.h"
 #include <win\hook.h>
+#include <shellapi.h>
 #define INCL_TIMERWIN32
 #include "timer.h"
+
+#define SC_ABOUTWINE            (SC_SCREENSAVE+1)
+#define SC_PUTMARK              (SC_SCREENSAVE+2)
 
 #define HAS_DLGFRAME(style,exStyle) \
@@ -53,5 +57,6 @@
 #define HAS_THICKFRAME(style,exStyle) \
     (((style) & WS_THICKFRAME) && \
-     !((exStyle) & WS_EX_DLGMODALFRAME))
+     !((exStyle) & WS_EX_DLGMODALFRAME) && \
+     !((style) & WS_CHILD))
 
 #define HAS_THINFRAME(style) \
@@ -183,5 +188,6 @@
   OS2Hwnd          = 0;
   OS2HwndFrame     = 0;
-  OS2HwndMenu      = 0;
+  hMenu            = 0;
+  hSysMenu         = 0;
   Win32Hwnd        = 0;
 
@@ -223,6 +229,4 @@
   horzScrollInfo     = NULL;
   vertScrollInfo     = NULL;
-  hwndHorzScroll     = 0;
-  hwndVertScroll     = 0;
 
   ownDC              = 0;
@@ -644,7 +648,4 @@
 
   OSLibWinSetOwner(OS2Hwnd, OS2HwndFrame);
-
-  //FrameGetScrollBarHandles(this,dwStyle & WS_HSCROLL,dwStyle & WS_VSCROLL);
-  //subclassScrollBars(dwStyle & WS_HSCROLL,dwStyle & WS_VSCROLL);
 
   fakeWinBase.hwndThis     = OS2Hwnd;
@@ -1223,90 +1224,4 @@
 //******************************************************************************
 //******************************************************************************
-VOID Win32BaseWindow::subclassScrollBars(BOOL subHorz,BOOL subVert)
-{
-  SCROLL_SubclassScrollBars(subHorz ? hwndHorzScroll:0,subVert ? hwndVertScroll:0);
-}
-//******************************************************************************
-//******************************************************************************
-BOOL Win32BaseWindow::showScrollBars(BOOL changeHorz,BOOL changeVert,BOOL fShow)
-{
-  BOOL rc = TRUE;
-  DWORD flags = 0;
-
-  if (fShow)
-  {
-    BOOL createHorz = FALSE,createVert = FALSE;
-    BOOL showHorz = FALSE,showVert = FALSE;
-
-    if (changeHorz)
-    {
-      if (!hwndHorzScroll)
-        createHorz = TRUE;
-      else
-        showHorz = TRUE;
-    }
-
-    if (changeVert)
-    {
-      if (!hwndVertScroll)
-        createVert = TRUE;
-      else
-        showVert = TRUE;
-    }
-
-    if (createHorz || createVert)
-    {
-      if (createHorz && !horzScrollInfo)
-      {
-        horzScrollInfo = (SCROLLBAR_INFO*)malloc(sizeof(SCROLLBAR_INFO));
-        horzScrollInfo->MinVal = horzScrollInfo->CurVal = horzScrollInfo->Page = 0;
-        horzScrollInfo->MaxVal = 100;
-        horzScrollInfo->flags  = ESB_ENABLE_BOTH;
-      }
-
-      if (createVert && !vertScrollInfo)
-      {
-        vertScrollInfo = (SCROLLBAR_INFO*)malloc(sizeof(SCROLLBAR_INFO));
-        vertScrollInfo->MinVal = vertScrollInfo->CurVal = vertScrollInfo->Page = 0;
-        vertScrollInfo->MaxVal = 100;
-        vertScrollInfo->flags  = ESB_ENABLE_BOTH;
-      }
-
-      rc = FrameCreateScrollBars(this,createHorz,createVert,FALSE,&flags);
-
-      if (!rc) return FALSE;
-      if (createHorz) dwStyle |= WS_HSCROLL;
-      if (createVert) dwStyle |= WS_VSCROLL;
-    }
-
-    if (showVert || showHorz)
-    {
-      DWORD newFlags;
-
-      rc = FrameShowScrollBars(this,showHorz,showVert,fShow,FALSE,&newFlags);
-      flags |= newFlags;
-      if (rc)
-      {
-        if (showHorz) dwStyle |= WS_HSCROLL;
-        if (showVert) dwStyle |= WS_VSCROLL;
-      }
-    }
-
-    if (flags) FrameUpdateFrame(this,flags);
-  } else
-  {
-    rc = FrameShowScrollBars(this,changeHorz && hwndHorzScroll,changeVert && hwndVertScroll,fShow,TRUE);
-
-    if (rc)
-    {
-      if (changeHorz) dwStyle &= ~WS_HSCROLL;
-      if (changeVert) dwStyle &= ~WS_VSCROLL;
-    }
-  }
-
-  return rc;
-}
-//******************************************************************************
-//******************************************************************************
 LONG Win32BaseWindow::HandleNCActivate(WPARAM wParam)
 {
@@ -1429,4 +1344,51 @@
 //******************************************************************************
 //******************************************************************************
+VOID Win32BaseWindow::TrackScrollBar(WPARAM wParam,POINT pt)
+{
+  INT scrollbar;
+  MSG msg;
+
+  if ((wParam & 0xfff0) == SC_HSCROLL)
+  {
+    if ((wParam & 0x0f) != HTHSCROLL) return;
+    scrollbar = SB_HORZ;
+  } else  /* SC_VSCROLL */
+  {
+    if ((wParam & 0x0f) != HTVSCROLL) return;
+    scrollbar = SB_VERT;
+  }
+
+  pt.x -= rectWindow.left;
+  pt.y -= rectWindow.top;
+  SCROLL_HandleScrollEvent(Win32Hwnd,0,MAKELONG(pt.x,pt.y),scrollbar,WM_LBUTTONDOWN);
+  if (GetCapture() != Win32Hwnd) return;
+  do
+  {
+    GetMessageA(&msg,Win32Hwnd,0,0);
+    switch(msg.message)
+    {
+      case WM_LBUTTONUP:
+      case WM_MOUSEMOVE:
+        pt.x = msg.pt.x-rectWindow.left;
+        pt.y = msg.pt.y-rectWindow.top;
+        msg.lParam = MAKELONG(pt.x,pt.y);
+      case WM_SYSTIMER:
+        SCROLL_HandleScrollEvent(Win32Hwnd,msg.wParam,msg.lParam,scrollbar,msg.message);
+        break;
+
+      default:
+        TranslateMessage(&msg);
+        DispatchMessageA(&msg);
+        break;
+    }
+    if (!IsWindow())
+    {
+      ReleaseCapture();
+      break;
+    }
+  } while (msg.message != WM_LBUTTONUP);
+}
+//******************************************************************************
+//******************************************************************************
 LONG Win32BaseWindow::HandleNCLButtonDown(WPARAM wParam,LPARAM lParam)
 {
@@ -1824,5 +1786,5 @@
     if(hIcon == 0)
       if (!(dwStyle & DS_MODALFRAME))
-        hIcon = LoadImageA(0, MAKEINTRESOURCEA(OIC_WINEICON), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR);
+        hIcon = LoadImageA(0, MAKEINTRESOURCEA(OIC_ODINICON), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR);
 
     if (hIcon)
@@ -1986,5 +1948,9 @@
   r.bottom--;
 
-  FillRect( hdc, &r, GetSysColorBrush(active ? COLOR_ACTIVECAPTION : COLOR_INACTIVECAPTION) );
+  //CB: todo:
+   //COLOR_GRADIENTACTIVECAPTION
+   //COLOR_GRADIENTINACTIVECAPTION
+
+  FillRect(hdc,&r,GetSysColorBrush(active ? COLOR_ACTIVECAPTION:COLOR_INACTIVECAPTION));
 
   if (!hbitmapClose)
@@ -2135,10 +2101,9 @@
 
   /* Draw the scroll-bars */
-#if 0 //CB: todo
   if (dwStyle & WS_VSCROLL)
-    SCROLL_DrawScrollBar(hwnd,hdc,SB_VERT,TRUE,TRUE);
-  if (wndPtr->dwStyle & WS_HSCROLL)
-    SCROLL_DrawScrollBar(hwnd,hdc,SB_HORZ,TRUE,TRUE);
-#endif
+    SCROLL_DrawScrollBar(Win32Hwnd,hdc,SB_VERT,TRUE,TRUE);
+  if (dwStyle & WS_HSCROLL)
+    SCROLL_DrawScrollBar(Win32Hwnd,hdc,SB_HORZ,TRUE,TRUE);
+
   /* Draw the "size-box" */
   if ((dwStyle & WS_VSCROLL) && (dwStyle & WS_HSCROLL))
@@ -2247,11 +2212,12 @@
  * TODO: Not done (see #if 0)
  */
-LONG Win32BaseWindow::HandleSysCommand(WPARAM wParam, POINT *pt32)
+LONG Win32BaseWindow::HandleSysCommand(WPARAM wParam,POINT *pt32)
 {
     UINT uCommand = wParam & 0xFFF0;
 
+/* //CB: don't need this, perhaps recycle for menus
     if ((getStyle() & WS_CHILD) && (uCommand != SC_KEYMENU))
         ScreenToClient(getParent()->getWindowHandle(), pt32 );
-
+*/
     switch (uCommand)
     {
@@ -2316,12 +2282,11 @@
 
     case SC_CLOSE:
-        return SendInternalMessageA(WM_CLOSE, 0, 0);
-
-#if 0
+        return SendInternalMessageA(WM_CLOSE,0,0);
+
     case SC_VSCROLL:
     case SC_HSCROLL:
-        NC_TrackScrollBar( hwnd, wParam, pt32 );
+        TrackScrollBar(wParam,*pt32);
         break;
-
+#if 0
     case SC_MOUSEMENU:
         MENU_TrackMouseMenuBar( wndPtr, wParam & 0x000F, pt32 );
@@ -2331,17 +2296,17 @@
         MENU_TrackKbdMenuBar( wndPtr , wParam , pt.x );
         break;
-
+#endif
     case SC_TASKLIST:
-        WinExec( "taskman.exe", SW_SHOWNORMAL );
+        WinExec("taskman.exe",SW_SHOWNORMAL);
         break;
 
     case SC_SCREENSAVE:
         if (wParam == SC_ABOUTWINE)
-            ShellAboutA(hwnd, "Odin", ODIN_RELEASE_INFO, 0);
+            ShellAboutA(Win32Hwnd,"Odin","Odin alpha release compiled with IBM VAC++",0);
         else
         if (wParam == SC_PUTMARK)
             dprintf(("Mark requested by user\n"));
         break;
-#endif
+
     case SC_HOTKEY:
     case SC_ARRANGE:
@@ -2719,5 +2684,5 @@
         point.x = LOWORD(lParam);
         point.y = HIWORD(lParam);
-        return HandleSysCommand(wParam, &point);
+        return HandleSysCommand(wParam,&point);
     }
 
@@ -3093,17 +3058,4 @@
         window = parentwindow;
    }
-}
-//******************************************************************************
-//******************************************************************************
-BOOL Win32BaseWindow::SetMenu(HMENU hMenu)
-{
-
-    dprintf(("SetMenu %x", hMenu));
-    OS2HwndMenu = OSLibWinSetMenu(OS2HwndFrame, hMenu);
-    if(OS2HwndMenu == 0) {
-        dprintf(("Win32BaseWindow::SetMenu OS2HwndMenu == 0"));
-        return FALSE;
-    }
-    return TRUE;
 }
 //******************************************************************************
Index: trunk/src/user32/new/win32wbase.h
===================================================================
--- trunk/src/user32/new/win32wbase.h	(revision 2379)
+++ trunk/src/user32/new/win32wbase.h	(revision 2381)
@@ -1,3 +1,3 @@
-/* $Id: win32wbase.h,v 1.19 2000-01-08 16:47:50 cbratschi Exp $ */
+/* $Id: win32wbase.h,v 1.20 2000-01-09 14:14:25 cbratschi Exp $ */
 /*
  * Win32 Window Base Class for OS/2
@@ -160,6 +160,8 @@
          void   setFlags(DWORD newflags)        { flags = newflags; };
 
-         HMENU  GetMenu()                           { return (HMENU) OS2HwndMenu; };
-         BOOL   SetMenu(ULONG hMenu);
+         HMENU  GetMenu()                           { return hMenu; };
+         VOID   SetMenu(HMENU newMenu)              { hMenu = newMenu; };
+         HMENU  GetSysMenu()                        { return hSysMenu; };
+         VOID   SetSysMenu(HMENU newSysMenu)        { hSysMenu = newSysMenu; };
 
          BOOL   SetIcon(HICON hIcon);
@@ -220,10 +222,4 @@
 
  SCROLLBAR_INFO *getScrollInfo(int nBar);
-       HWND      getVertScrollHandle()               { return hwndVertScroll; };
-       VOID      setVertScrollHandle(HWND newHandle) { hwndVertScroll = newHandle; }
-       HWND      getHorzScrollHandle()               { return hwndHorzScroll; };
-       VOID      setHorzScrollHandle(HWND newHandle) { hwndHorzScroll = newHandle; }
-       VOID      subclassScrollBars(BOOL subHorz,BOOL subVert);
-       BOOL      showScrollBars(BOOL changeHorz,BOOL changeVert,BOOL fShow);
 
        LRESULT  SendMessageA(ULONG msg, WPARAM wParam, LPARAM lParam);
@@ -283,5 +279,6 @@
         HWND    OS2Hwnd;
         HWND    OS2HwndFrame;
-        HWND    OS2HwndMenu;
+        HMENU   hMenu;
+        HMENU   hSysMenu;
         HWND    Win32Hwnd;
         BOOL    isUnicode;
@@ -349,6 +346,4 @@
 SCROLLBAR_INFO *vertScrollInfo;
 SCROLLBAR_INFO *horzScrollInfo;
-        HWND    hwndHorzScroll; //os/2 handle
-        HWND    hwndVertScroll; //os/2 handle
 
 Win32WndClass  *windowClass;
@@ -363,4 +358,5 @@
         VOID  TrackMinMaxBox(WORD wParam);
         VOID  TrackCloseButton(WORD wParam);
+        VOID  TrackScrollBar(WPARAM wParam,POINT pt);
         LONG  HandleNCLButtonDown(WPARAM wParam,LPARAM lParam);
         LONG  HandleNCLButtonDblClk(WPARAM wParam,LPARAM lParam);
