Index: trunk/src/user32/win32wbase.cpp
===================================================================
--- trunk/src/user32/win32wbase.cpp	(revision 6925)
+++ trunk/src/user32/win32wbase.cpp	(revision 6927)
@@ -1,3 +1,3 @@
-/* $Id: win32wbase.cpp,v 1.286 2001-09-30 22:24:41 sandervl Exp $ */
+/* $Id: win32wbase.cpp,v 1.287 2001-10-01 17:28:08 sandervl Exp $ */
 /*
  * Win32 Window Base Class for OS/2
@@ -3279,4 +3279,38 @@
 
         break;
+
+    case GW_HWNDNEXTCHILD:
+        lock();
+        window = (Win32BaseWindow *)getNextChild();
+        if(window) {
+             hwndRelated = window->getWindowHandle();
+        }
+        else hwndRelated = 0;
+        unlock();
+        break;
+
+    case GW_HWNDFIRSTCHILD:
+        lock();
+        window = (Win32BaseWindow *)getFirstChild();
+        if(window) {
+             hwndRelated = window->getWindowHandle();
+        }
+        else hwndRelated = 0;
+        unlock();
+        break;
+
+    case GW_HWNDLASTCHILD:
+        lock();
+        window = (Win32BaseWindow *)getFirstChild();
+        if(window) {
+             while (window->getNextChild())
+             {
+                window = (Win32BaseWindow *)window->getNextChild();
+             }
+             hwndRelated = window->getWindowHandle();
+        }
+        else hwndRelated = 0;
+        unlock();
+        break;
     }
 end:
@@ -3748,91 +3782,4 @@
 {
     dwIDMenu = id;
-}
-//******************************************************************************
-//******************************************************************************
-HWND Win32BaseWindow::getNextDlgGroupItem(HWND hwndCtrl, BOOL fPrevious)
-{
- Win32BaseWindow *firstchild = NULL, *child, *nextchild, *lastchild;
- HWND retvalue;
-
-    lock();
-    if (hwndCtrl)
-    {
-        firstchild = child = GetWindowFromHandle(hwndCtrl);
-        if (!child)
-        {
-            retvalue = 0;
-            goto END;
-        }
-        /* Make sure hwndCtrl is a top-level child */
-        while ((child->getStyle() & WS_CHILD) && (child->getParent() != this))
-        {
-            child = child->getParent();
-            if(child == NULL) break;
-        }
-        if (!child || (child->getParent() != this))
-        {
-            retvalue = 0;
-            goto END;
-        }
-    }
-    else
-    {
-        /* No ctrl specified -> start from the beginning */
-        child = (Win32BaseWindow *)getFirstChild();
-        if (!child)
-        {
-            retvalue = 0;
-            goto END;
-        }
-
-        if (fPrevious)
-        {
-            while (child->getNextChild())
-            {
-                child = (Win32BaseWindow *)child->getNextChild();
-            }
-        }
-    }
-
-    lastchild = child;
-    nextchild = (Win32BaseWindow *)child->getNextChild();
-    while (TRUE)
-    {
-        if (!nextchild || (nextchild->getStyle() & WS_GROUP))
-        {
-            /* Wrap-around to the beginning of the group */
-            Win32BaseWindow *pWndTemp;
-
-            nextchild = (Win32BaseWindow *)getFirstChild();
-
-            for(pWndTemp = nextchild;pWndTemp;pWndTemp = (Win32BaseWindow *)pWndTemp->getNextChild())
-            {
-                if (pWndTemp->getStyle() & WS_GROUP)
-                    nextchild = pWndTemp;
-
-                if (pWndTemp == child)
-                    break;
-            }
-
-        }
-        if (nextchild == child)
-            break;
-
-        if ((nextchild->getStyle() & WS_VISIBLE) && !(nextchild->getStyle() & WS_DISABLED))
-        {
-            lastchild = nextchild;
-
-            if (!fPrevious)
-                break;
-        }
-
-        nextchild = (Win32BaseWindow *)nextchild->getNextChild();
-    }
-    retvalue = lastchild->getWindowHandle();
-END:
-    unlock();
-    if(firstchild) RELEASE_WNDOBJ(firstchild);
-    return retvalue;
 }
 //******************************************************************************
Index: trunk/src/user32/win32wbase.h
===================================================================
--- trunk/src/user32/win32wbase.h	(revision 6925)
+++ trunk/src/user32/win32wbase.h	(revision 6927)
@@ -1,3 +1,3 @@
-/* $Id: win32wbase.h,v 1.127 2001-09-30 22:24:42 sandervl Exp $ */
+/* $Id: win32wbase.h,v 1.128 2001-10-01 17:28:08 sandervl Exp $ */
 /*
  * Win32 Window Base Class for OS/2
@@ -36,4 +36,8 @@
 #define WIN32PM_MAGIC           0x12345678
 #define CheckMagicDword(a)      (a==WIN32PM_MAGIC)
+
+#define GW_HWNDNEXTCHILD          (0x10000 | GW_HWNDNEXT)
+#define GW_HWNDFIRSTCHILD         (0x10000 | GW_CHILD)
+#define GW_HWNDLASTCHILD          (0x10000 | GW_HWNDLAST)
 
 #ifdef DEBUG
@@ -335,5 +339,4 @@
            BOOL EnumWindows(WNDENUMPROC lpfn, LPARAM lParam);
 
-         HWND   getNextDlgGroupItem(HWND hwndCtrl, BOOL fPrevious);
 
 	 BOOL   isComingToTop()			{ return fComingToTop; };
Index: trunk/src/user32/windlg.cpp
===================================================================
--- trunk/src/user32/windlg.cpp	(revision 6925)
+++ trunk/src/user32/windlg.cpp	(revision 6927)
@@ -1,3 +1,3 @@
-/* $Id: windlg.cpp,v 1.24 2001-07-23 19:16:41 sandervl Exp $ */
+/* $Id: windlg.cpp,v 1.25 2001-10-01 17:28:09 sandervl Exp $ */
 /*
  * Win32 dialog apis for OS/2
@@ -491,5 +491,5 @@
   long result = 0;
 
-    dprintf(("USER32:  GetDlgItemInt\n"));
+    dprintf(("USER32: GetDlgItemInt %x %x %x %d", hwnd, id, translated, fSigned));
     if (translated) *translated = FALSE;
 
@@ -517,16 +517,84 @@
 //******************************************************************************
 //******************************************************************************
-HWND WIN32API GetNextDlgGroupItem( HWND hwnd, HWND hwndCtrl, BOOL fPrevious)
-{
-  Win32BaseWindow *window;
-
-    window = Win32BaseWindow::GetWindowFromHandle(hwnd);
-    if(!window) {
+HWND WIN32API GetNextDlgGroupItem( HWND hwndDlg, HWND hwndCtrl, BOOL fPrevious)
+{
+    HWND hwnd, retvalue;
+
+    if(!IsWindow(hwndDlg) || (hwndCtrl && !IsWindow(hwndCtrl))) {
         dprintf(("GetNextDlgGroupItem, window %x not found", hwnd));
         SetLastError(ERROR_INVALID_WINDOW_HANDLE);
         return 0;
     }
-    dprintf(("USER32:  GetNextDlgGroupItem\n"));
-    return window->getNextDlgGroupItem(hwndCtrl, fPrevious);
+    dprintf(("USER32: GetNextDlgGroupItem %x %x %d", hwndDlg, hwndCtrl, fPrevious));
+
+    #define WIN_GetFullHandle(a)	a
+
+    hwndDlg = WIN_GetFullHandle( hwndDlg );
+    hwndCtrl = WIN_GetFullHandle( hwndCtrl );
+
+    if(hwndCtrl)
+    {
+        /* if the hwndCtrl is the child of the control in the hwndDlg,
+	 * then the hwndDlg has to be the parent of the hwndCtrl */
+        if(GetParent(hwndCtrl) != hwndDlg && GetParent(GetParent(hwndCtrl)) == hwndDlg)
+            hwndDlg = GetParent(hwndCtrl);
+    }
+
+    if (hwndCtrl)
+    {
+        /* Make sure hwndCtrl is a top-level child */
+        HWND parent = GetParent( hwndCtrl );
+        while (parent && parent != hwndDlg) parent = GetParent(parent);
+        if (parent != hwndDlg) return 0;
+    }
+    else
+    {
+        /* No ctrl specified -> start from the beginning */
+        if (!(hwndCtrl = GetWindow( hwndDlg, GW_CHILD ))) return 0;
+#ifdef __WIN32OS2__
+        if (fPrevious) hwndCtrl = GetWindow( hwndCtrl, GW_HWNDLASTCHILD );
+#else
+        if (fPrevious) hwndCtrl = GetWindow( hwndCtrl, GW_HWNDLAST );
+#endif
+    }
+
+    retvalue = hwndCtrl;
+#ifdef __WIN32OS2__
+    hwnd = GetWindow( hwndCtrl, GW_HWNDNEXTCHILD );
+#else
+    hwnd = GetWindow( hwndCtrl, GW_HWNDNEXT );
+#endif
+    while (1)
+    {
+        if (!hwnd || (GetWindowLongW( hwnd, GWL_STYLE ) & WS_GROUP))
+        {
+            /* Wrap-around to the beginning of the group */
+            HWND tmp;
+
+#ifdef __WIN32OS2__
+            hwnd = GetWindow( hwndDlg, GW_HWNDFIRSTCHILD );
+            for (tmp = hwnd; tmp; tmp = GetWindow( tmp, GW_HWNDNEXTCHILD ) )
+#else
+            hwnd = GetWindow( hwndDlg, GW_CHILD );
+            for (tmp = hwnd; tmp; tmp = GetWindow( tmp, GW_HWNDNEXT ) )
+#endif
+            {
+                if (GetWindowLongW( tmp, GWL_STYLE ) & WS_GROUP) hwnd = tmp;
+                if (tmp == hwndCtrl) break;
+            }
+        }
+        if (hwnd == hwndCtrl) break;
+        if ((GetWindowLongW( hwnd, GWL_STYLE ) & (WS_VISIBLE|WS_DISABLED)) == WS_VISIBLE)
+        {
+            retvalue = hwnd;
+	    if (!fPrevious) break;
+	}
+#ifdef __WIN32OS2__
+        hwnd = GetWindow( hwnd, GW_HWNDNEXTCHILD );
+#else
+        hwnd = GetWindow( hwnd, GW_HWNDNEXT );
+#endif
+    }
+    return retvalue;
 }
 /***********************************************************************
