Index: trunk/src/user32/oslibwin.cpp
===================================================================
--- trunk/src/user32/oslibwin.cpp	(revision 1246)
+++ trunk/src/user32/oslibwin.cpp	(revision 1248)
@@ -1,3 +1,3 @@
-/* $Id: oslibwin.cpp,v 1.19 1999-10-10 08:59:40 sandervl Exp $ */
+/* $Id: oslibwin.cpp,v 1.20 1999-10-11 16:04:50 cbratschi Exp $ */
 /*
  * Window API wrappers for OS/2
@@ -67,5 +67,6 @@
 //                dwFrameStyle |= FCF_TITLEBAR;
 
-        dwFrameStyle |= FCF_TASKLIST | FCF_NOMOVEWITHOWNER | FCF_NOBYTEALIGN;
+        dwFrameStyle |= FCF_NOBYTEALIGN;
+        if (hwndParent == HWND_DESKTOP) dwFrameStyle |= FCF_TASKLIST | FCF_NOMOVEWITHOWNER;
         dwWinStyle   &= ~WS_CLIPCHILDREN;
 
@@ -90,5 +91,5 @@
 //******************************************************************************
 //******************************************************************************
-BOOL OSLibWinConvertStyle(ULONG dwStyle, ULONG dwExStyle, ULONG *OSWinStyle, ULONG *OSFrameStyle, ULONG *borderWidth, ULONG *borderHeight)
+BOOL OSLibWinConvertStyle(ULONG dwStyle, ULONG *dwExStyle, ULONG *OSWinStyle, ULONG *OSFrameStyle, ULONG *borderWidth, ULONG *borderHeight)
 {
   *OSWinStyle   = 0;
@@ -120,25 +121,37 @@
   if (dwStyle & WS_CHILD_W)
   {
-//SvL: Causes crash in VPBuddy if enabled
+//SvL: Causes crash in VPBuddy if enabled -> find bug
 #if 0
-    if (dwStyle & WS_BORDER_W ||
-        dwStyle & WS_DLGFRAME_W ||
-        dwStyle & WS_THICKFRAME_W)
-          if (!HAS_3DFRAME(dwExStyle)) dwExStyle |= WS_EX_WINDOWEDGE_W;
+    if (!HAS_3DFRAME(*dwExStyle) && (dwStyle & (WS_DLGFRAME_W | WS_THICKFRAME_W))) *dwExStyle |= WS_EX_DLGMODALFRAME_W;
 #endif
 
-    if (dwExStyle & WS_EX_CLIENTEDGE_W ||
-        dwExStyle & WS_EX_STATICEDGE_W ||
-        dwExStyle & WS_EX_WINDOWEDGE_W)
-          {
-            *OSFrameStyle |= FCF_DLGBORDER;
-            *borderHeight = *borderWidth = 2; //CB: right?
-          }
+    if (*dwExStyle & WS_EX_CLIENTEDGE_W)
+    {
+      *OSFrameStyle |= FCF_SIZEBORDER;
+      *borderHeight = *borderWidth = 2;
+    } else if (*dwExStyle & WS_EX_DLGMODALFRAME_W)
+    {
+      *OSFrameStyle |= FCF_SIZEBORDER;
+      *borderHeight = *borderWidth = 3;
+    } else if (*dwExStyle & WS_EX_STATICEDGE_W)
+    {
+      *OSFrameStyle |= FCF_SIZEBORDER;
+      *borderHeight = *borderWidth = 1;
+
+    } else if (*dwExStyle & WS_EX_WINDOWEDGE_W); //no border
+//SvL: Causes crash in VPBuddy if enabled -> find bug
+#if 0
+    else if (dwStyle & WS_BORDER_W)
+    {
+      *OSFrameStyle |= FCF_SIZEBORDER;
+      *borderHeight = *borderWidth = 1;
+    }
+#endif
+
     if(dwStyle & WS_VSCROLL_W)
           *OSFrameStyle |= FCF_VERTSCROLL;
     if(dwStyle & WS_HSCROLL_W)
           *OSFrameStyle |= FCF_HORZSCROLL;
-  } 
-  else
+  } else
   {
     if((dwStyle & WS_CAPTION_W) == WS_CAPTION_W)
@@ -164,5 +177,5 @@
           *OSFrameStyle |= FCF_MAXBUTTON;
 
-    if(dwExStyle & WS_EX_DLGMODALFRAME_W)
+    if(*dwExStyle & WS_EX_DLGMODALFRAME_W)
           *OSFrameStyle |= FCF_DLGBORDER;
   }
@@ -842,7 +855,7 @@
 void OSLibSetWindowStyle(HWND hwnd, ULONG dwStyle)
 {
-  ULONG OSWinStyle, OSFrameStyle, borderWidth, borderHeight;
-
-  OSLibWinConvertStyle(dwStyle, 0, &OSWinStyle, &OSFrameStyle, &borderWidth, &borderHeight);
+  ULONG OSWinStyle, OSFrameStyle, borderWidth, borderHeight,dwExStyle;
+
+  OSLibWinConvertStyle(dwStyle, &dwExStyle, &OSWinStyle, &OSFrameStyle, &borderWidth, &borderHeight);
 
   WinSetWindowULong(hwnd, QWL_STYLE,
Index: trunk/src/user32/oslibwin.h
===================================================================
--- trunk/src/user32/oslibwin.h	(revision 1246)
+++ trunk/src/user32/oslibwin.h	(revision 1248)
@@ -1,3 +1,3 @@
-/* $Id: oslibwin.h,v 1.12 1999-10-08 16:13:08 cbratschi Exp $ */
+/* $Id: oslibwin.h,v 1.13 1999-10-11 16:04:51 cbratschi Exp $ */
 /*
  * Window API wrappers for OS/2
@@ -39,5 +39,5 @@
                            char *pszName, HWND Owner, ULONG fHWND_BOTTOM, HWND *hwndFrame);
 
-BOOL  OSLibWinConvertStyle(ULONG dwStyle, ULONG dwExStyle, ULONG *OSWinStyle, ULONG *OSFrameStyle, ULONG *borderWidth, ULONG *borderHeight);
+BOOL  OSLibWinConvertStyle(ULONG dwStyle, ULONG *dwExStyle, ULONG *OSWinStyle, ULONG *OSFrameStyle, ULONG *borderWidth, ULONG *borderHeight);
 void  OSLibSetWindowStyle(HWND hwnd, ULONG dwStyle);
 
Index: trunk/src/user32/pmframe.cpp
===================================================================
--- trunk/src/user32/pmframe.cpp	(revision 1246)
+++ trunk/src/user32/pmframe.cpp	(revision 1248)
@@ -1,3 +1,3 @@
-/* $Id: pmframe.cpp,v 1.3 1999-10-09 09:45:27 sandervl Exp $ */
+/* $Id: pmframe.cpp,v 1.4 1999-10-11 16:04:51 cbratschi Exp $ */
 /*
  * Win32 Frame Managment Code for OS/2
@@ -21,4 +21,137 @@
 #include "wprocess.h"
 #include "pmframe.h"
+#include "oslibutil.h"
+
+#define PMFRAMELOG
+
+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);
+}
+
+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();
+
+  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->isChild() && 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;
+
+  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;
+  }
+}
 
 //******************************************************************************
@@ -45,10 +178,123 @@
   {
     case WM_DESTROY:
+      #ifdef PMFRAMELOG
+       dprintf(("PMFRAME: WM_DESTROY"));
+      #endif
       WinSubclassWindow(hwnd,OldFrameProc);
       win32wnd->setOldFrameProc(NULL);
       goto RunDefFrameProc;
 
+    case WM_MOUSEMOVE:
+      #ifdef PMFRAMELOG
+       dprintf(("PMFRAME: WM_MOUSEMOVE"));
+      #endif
+      if (InSizeBox(win32wnd,(POINTS*)&mp1))
+      {
+        WinSetPointer(HWND_DESKTOP,WinQuerySysPointer(HWND_DESKTOP,SPTR_SIZENWSE,FALSE));
+        RestoreOS2TIB();
+        return (MRESULT)TRUE;
+      } else if (win32wnd->isChild()) goto RunDefWndProc;
+      else goto RunDefFrameProc;
+
+    case WM_BUTTON1DOWN:
+      #ifdef PMFRAMELOG
+       dprintf(("PMFRAME: WM_BUTTON1DOWN"));
+      #endif
+      if (InSizeBox(win32wnd,(POINTS*)&mp1))
+      {
+        WinSendMsg(hwnd,WM_TRACKFRAME,(MPARAM)(TF_RIGHT | TF_BOTTOM),(MPARAM)0);
+        RestoreOS2TIB();
+        return (MRESULT)TRUE;
+      } else if (win32wnd->isChild()) goto RunDefWndProc;
+      else goto RunDefFrameProc;
+
+    case WM_BUTTON2DOWN:
+    case WM_BUTTON3DOWN:
+      #ifdef PMFRAMELOG
+       dprintf(("PMFRAME: WM_BUTTON2/3DOWN"));
+      #endif
+      if (win32wnd->isChild()) goto RunDefWndProc;
+      else goto RunDefFrameProc;
+
+    case WM_ACTIVATE:
+      #ifdef PMFRAMELOG
+       dprintf(("PMFRAME: WM_ACTIVATE"));
+      #endif
+      if (!win32wnd->isChild())
+      {
+        if (CanDrawSizeBox(win32wnd))
+        {
+          MRESULT res;
+          HPS hps;
+          RECTL rect;
+
+          RestoreOS2TIB();
+          res = OldFrameProc(hwnd,msg,mp1,mp2);
+          SetWin32TIB();
+
+          GetSizeBox(win32wnd,&rect);
+          hps = WinGetPS(hwnd);
+          DrawSizeBox(hps,rect);
+          WinReleasePS(hps);
+
+          RestoreOS2TIB();
+          return res;
+        } else goto RunDefFrameProc;
+      } else
+      {
+        MRESULT res;
+        HPS hps;
+        RECTL rect;
+
+        RestoreOS2TIB();
+        res = OldFrameProc(hwnd,msg,mp1,mp2);
+        SetWin32TIB();
+
+        hps = WinGetClipPS(hwnd,0,PSF_CLIPCHILDREN);
+        WinQueryWindowRect(hwnd,&rect);
+        DrawFrame(hps,&rect,win32wnd);
+        WinFillRect(hps,&rect,SYSCLR_DIALOGBACKGROUND);
+        WinReleasePS(hps);
+
+        RestoreOS2TIB();
+        return res;
+      }
+
     case WM_PAINT:
-      //CB: todo
+      #ifdef PMFRAMELOG
+       dprintf(("PMFRAME: WM_PAINT"));
+      #endif
+      if (!win32wnd->isChild())
+      {
+        if (CanDrawSizeBox(win32wnd))
+        {
+          MRESULT res;
+          HPS hps;
+          RECTL rect;
+
+          RestoreOS2TIB();
+          res = OldFrameProc(hwnd,msg,mp1,mp2);
+          SetWin32TIB();
+
+          GetSizeBox(win32wnd,&rect);
+          hps = WinGetPS(hwnd);
+          DrawSizeBox(hps,rect);
+          WinReleasePS(hps);
+
+          RestoreOS2TIB();
+          return res;
+        } else goto RunDefFrameProc;
+      } else
+      {
+        RECTL rect;
+        HPS hps = WinBeginPaint(hwnd,0,&rect);
+
+        DrawFrame(hps,&rect,win32wnd);
+        WinFillRect(hps,&rect,SYSCLR_DIALOGBACKGROUND);
+        WinEndPaint(hps);
+
+        RestoreOS2TIB();
+        return (MRESULT)0;
+      }
 
     default:
@@ -74,6 +320,39 @@
 }
 
-VOID FrameSetBorderSize(Win32BaseWindow *win32wnd)
-{
+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);
+}
Index: trunk/src/user32/pmframe.h
===================================================================
--- trunk/src/user32/pmframe.h	(revision 1246)
+++ trunk/src/user32/pmframe.h	(revision 1248)
@@ -1,3 +1,3 @@
-/* $Id: pmframe.h,v 1.1 1999-10-08 16:13:08 cbratschi Exp $ */
+/* $Id: pmframe.h,v 1.2 1999-10-11 16:04:51 cbratschi Exp $ */
 /*
  * Win32 Frame Managment Code for OS/2
@@ -10,5 +10,6 @@
 
 PVOID FrameSubclassFrameWindow(Win32BaseWindow *win32wnd);
-VOID  FrameSetBorderSize(Win32BaseWindow *win32wnd);
+VOID  FrameSetBorderSize(Win32BaseWindow *win32wnd,BOOL resize);
+UINT  FrameGetDefSizeBorderSize(VOID);
 
 #endif
Index: trunk/src/user32/win32dlg.cpp
===================================================================
--- trunk/src/user32/win32dlg.cpp	(revision 1246)
+++ trunk/src/user32/win32dlg.cpp	(revision 1248)
@@ -1,3 +1,3 @@
-/* $Id: win32dlg.cpp,v 1.9 1999-10-10 08:59:41 sandervl Exp $ */
+/* $Id: win32dlg.cpp,v 1.10 1999-10-11 16:04:51 cbratschi Exp $ */
 /*
  * Win32 Dialog Code for OS/2
@@ -1060,9 +1060,9 @@
         if (nextchild == child) break;
 
-	    if ((nextchild->getStyle() & WS_VISIBLE) && !(nextchild->getStyle() & WS_DISABLED))
-	    {
-	        lastchild = nextchild;
-    	    if (!fPrevious) break;
-    	}
+            if ((nextchild->getStyle() & WS_VISIBLE) && !(nextchild->getStyle() & WS_DISABLED))
+            {
+                lastchild = nextchild;
+            if (!fPrevious) break;
+        }
     }
     retvalue = lastchild->getWindowHandle();
Index: trunk/src/user32/win32wbase.cpp
===================================================================
--- trunk/src/user32/win32wbase.cpp	(revision 1246)
+++ trunk/src/user32/win32wbase.cpp	(revision 1248)
@@ -1,3 +1,3 @@
-/* $Id: win32wbase.cpp,v 1.34 1999-10-11 15:26:05 sandervl Exp $ */
+/* $Id: win32wbase.cpp,v 1.35 1999-10-11 16:04:51 cbratschi Exp $ */
 /*
  * Win32 Window Base Class for OS/2
@@ -432,5 +432,6 @@
   DWORD dwOSWinStyle, dwOSFrameStyle;
 
-  OSLibWinConvertStyle(cs->style, cs->dwExStyle, &dwOSWinStyle, &dwOSFrameStyle, &borderWidth, &borderHeight);
+  OSLibWinConvertStyle(cs->style, &cs->dwExStyle, &dwOSWinStyle, &dwOSFrameStyle, &borderWidth, &borderHeight);
+  dwExStyle = cs->dwExStyle;
 
 //CB: dwOSFrameStyle handled by OSLibWinConvertStyle
@@ -532,5 +533,5 @@
                      rectClient.right-rectClient.left,
                      rectClient.bottom-rectClient.top,
-                     SWP_NOACTIVATE | SWP_NOZORDER);
+                     SWP_NOACTIVATE | SWP_NOZORDER );
   }
   else {
@@ -540,10 +541,10 @@
                      SWP_NOACTIVATE);
   }
+
   //Subclass frame
-
   if (isFrameWindow())
   {
     pOldFrameProc = FrameSubclassFrameWindow(this);
-    if (dwStyle & WS_CHILD && HAS_3DFRAME(dwExStyle)) FrameSetBorderSize(this);
+    if (isChild()) FrameSetBorderSize(this,TRUE);
   }
 
@@ -1456,5 +1457,5 @@
     if( ctlType == CTLCOLOR_SCROLLBAR)
     {
-	    HBRUSH hb = GetSysColorBrush(COLOR_SCROLLBAR);
+            HBRUSH hb = GetSysColorBrush(COLOR_SCROLLBAR);
         COLORREF bk = GetSysColor(COLOR_3DHILIGHT);
         SetTextColor( hdc, GetSysColor(COLOR_3DFACE));
@@ -1471,5 +1472,5 @@
         }
 #endif
-    	UnrealizeObject( hb );
+        UnrealizeObject( hb );
         return (LRESULT)hb;
     }
@@ -1477,13 +1478,13 @@
     SetTextColor( hdc, GetSysColor(COLOR_WINDOWTEXT));
 
-	if ((ctlType == CTLCOLOR_EDIT) || (ctlType == CTLCOLOR_LISTBOX))
-	{
-	    SetBkColor( hdc, GetSysColor(COLOR_WINDOW) );
-	}
-	else
-	{
-	    SetBkColor( hdc, GetSysColor(COLOR_3DFACE) );
-	    return (LRESULT)GetSysColorBrush(COLOR_3DFACE);
-	}
+        if ((ctlType == CTLCOLOR_EDIT) || (ctlType == CTLCOLOR_LISTBOX))
+        {
+            SetBkColor( hdc, GetSysColor(COLOR_WINDOW) );
+        }
+        else
+        {
+            SetBkColor( hdc, GetSysColor(COLOR_3DFACE) );
+            return (LRESULT)GetSysColorBrush(COLOR_3DFACE);
+        }
     return (LRESULT)GetSysColorBrush(COLOR_WINDOW);
 }
@@ -1531,9 +1532,9 @@
 
     case WM_CTLCOLOR:
-	    return DefWndControlColor(HIWORD(lParam), (HDC)wParam);
+            return DefWndControlColor(HIWORD(lParam), (HDC)wParam);
 
     case WM_VKEYTOITEM:
     case WM_CHARTOITEM:
-	     return -1;
+             return -1;
 
     case WM_PARENTNOTIFY:
@@ -1967,5 +1968,5 @@
     dprintf(("ShowWindow %x", nCmdShow));
     if(fFirstShow) {
-        if(isFrameWindow() && IS_OVERLAPPED(getStyle())) {
+        if(isFrameWindow() && IS_OVERLAPPED(getStyle()) && !isChild()) {
                 SendMessageA(WM_SIZE, SIZE_RESTORED,
                                 MAKELONG(rectClient.right-rectClient.left,
@@ -2047,5 +2048,5 @@
        {
            hParent = getParent()->getOS2WindowHandle();
-           OSLibWinQueryWindowPos(OS2Hwnd, &swpOld);
+           OSLibWinQueryWindowPos(isFrameWindow() ? OS2HwndFrame:OS2Hwnd, &swpOld);
        }
        else
@@ -2064,12 +2065,15 @@
    if (isFrameWindow())
    {
-      POINT maxSize, maxPos, minTrack, maxTrack;
-
-      GetMinMaxInfo(&maxSize, &maxPos, &minTrack, &maxTrack);
-
-      if (swp.cx > maxTrack.x) swp.cx = maxTrack.x;
-      if (swp.cy > maxTrack.y) swp.cy = maxTrack.y;
-      if (swp.cx < minTrack.x) swp.cx = minTrack.x;
-      if (swp.cy < minTrack.y) swp.cy = minTrack.y;
+      if (!isChild())
+      {
+        POINT maxSize, maxPos, minTrack, maxTrack;
+
+        GetMinMaxInfo(&maxSize, &maxPos, &minTrack, &maxTrack);
+
+        if (swp.cx > maxTrack.x) swp.cx = maxTrack.x;
+        if (swp.cy > maxTrack.y) swp.cy = maxTrack.y;
+        if (swp.cx < minTrack.x) swp.cx = minTrack.x;
+        if (swp.cy < minTrack.y) swp.cy = minTrack.y;
+      }
 
       swp.hwnd = OS2HwndFrame;
@@ -2602,19 +2606,5 @@
 Win32BaseWindow *Win32BaseWindow::GetWindowFromOS2FrameHandle(HWND hwnd)
 {
- Win32BaseWindow *win32wnd;
- DWORD        magic;
-
   return GetWindowFromOS2Handle(OSLibWinWindowFromID(hwnd,OSLIB_FID_CLIENT));
-
-  //CB: doesn't work with frame window words
-/*
-  win32wnd = (Win32BaseWindow *)OSLibWinGetWindowULong(hwnd, OFFSET_WIN32WNDPTR);
-  magic    = OSLibWinGetWindowULong(hwnd, OFFSET_WIN32PM_MAGIC);
-
-  if(win32wnd && CheckMagicDword(magic)) {
-        return win32wnd;
-  }
-  return 0;
-*/
 }
 //******************************************************************************
@@ -2646,3 +2636,4 @@
 //******************************************************************************
 //******************************************************************************
+
 GenericObject *Win32BaseWindow::windows  = NULL;
Index: trunk/src/user32/win32wbase.h
===================================================================
--- trunk/src/user32/win32wbase.h	(revision 1246)
+++ trunk/src/user32/win32wbase.h	(revision 1248)
@@ -1,3 +1,3 @@
-/* $Id: win32wbase.h,v 1.17 1999-10-11 15:26:06 sandervl Exp $ */
+/* $Id: win32wbase.h,v 1.18 1999-10-11 16:04:52 cbratschi Exp $ */
 /*
  * Win32 Window Base Class for OS/2
@@ -205,6 +205,6 @@
        PVOID getOldFrameProc() { return pOldFrameProc; };
        VOID  setOldFrameProc(PVOID aOldFrameProc) { pOldFrameProc = aOldFrameProc; };
-       ULONG   getBorderWidth() { return borderWidth; };
-       ULONG   getBorderHeight() { return borderHeight; };
+       ULONG getBorderWidth() { return borderWidth; };
+       ULONG getBorderHeight() { return borderHeight; };
 
 protected:
Index: trunk/src/user32/windlg.cpp
===================================================================
--- trunk/src/user32/windlg.cpp	(revision 1246)
+++ trunk/src/user32/windlg.cpp	(revision 1248)
@@ -1,3 +1,3 @@
-/* $Id: windlg.cpp,v 1.4 1999-10-10 08:59:41 sandervl Exp $ */
+/* $Id: windlg.cpp,v 1.5 1999-10-11 16:04:52 cbratschi Exp $ */
 /*
  * Win32 dialog apis for OS/2
@@ -214,5 +214,5 @@
     if(!dialog || !dialog->IsDialog()) {
         dprintf(("GetNextDlgTabItem, window %x not found", hwndDlg));
-	SetLastError(ERROR_INVALID_WINDOW_HANDLE);
+        SetLastError(ERROR_INVALID_WINDOW_HANDLE);
         return 0;
     }
@@ -230,5 +230,5 @@
     if(!dialog || !dialog->IsDialog()) {
         dprintf(("GetDlgItem, window %x not found", hwnd));
-	SetLastError(ERROR_INVALID_WINDOW_HANDLE);
+        SetLastError(ERROR_INVALID_WINDOW_HANDLE);
         return 0;
     }
@@ -249,5 +249,5 @@
     if(!dlgcontrol) {
         dprintf(("GetDlgCtrlID, control %x not found", hwnd));
-	SetLastError(ERROR_INVALID_WINDOW_HANDLE);
+        SetLastError(ERROR_INVALID_WINDOW_HANDLE);
         return 0;
     }
@@ -264,5 +264,5 @@
     if(!dialog || !dialog->IsDialog()) {
         dprintf(("GetDlgItem, window %x not found", hwnd));
-	SetLastError(ERROR_INVALID_WINDOW_HANDLE);
+        SetLastError(ERROR_INVALID_WINDOW_HANDLE);
         return 0;
     }
@@ -357,5 +357,5 @@
     if(!dialog || !dialog->IsDialog()) {
         dprintf(("GetNextDlgGroupItem, window %x not found", hwnd));
-	SetLastError(ERROR_INVALID_WINDOW_HANDLE);
+        SetLastError(ERROR_INVALID_WINDOW_HANDLE);
         return 0;
     }
