Index: trunk/src/user32/controls.cpp
===================================================================
--- trunk/src/user32/controls.cpp	(revision 2581)
+++ trunk/src/user32/controls.cpp	(revision 2582)
@@ -1,3 +1,3 @@
-/* $Id: controls.cpp,v 1.8 2000-01-18 20:10:32 sandervl Exp $ */
+/* $Id: controls.cpp,v 1.9 2000-01-31 22:30:51 sandervl Exp $ */
 /* File: controls.cpp -- Win32 common controls
  *
@@ -28,4 +28,11 @@
 void CONTROLS_Register()
 {
+  dprintf(("Register DESKTOP class"));
+  controlAtoms[DESKTOP_CONTROL] = DESKTOP_Register();
+  if (!controlAtoms[DESKTOP_CONTROL]) dprintf(("failed!!!"));
+
+  //SvL: Create Desktop Window
+  CreateWin32Desktop();
+
   dprintf(("Register BUTTON class"));
   controlAtoms[BUTTON_CONTROL] = BUTTON_Register();
@@ -63,8 +70,4 @@
   controlAtoms[DIALOG_CONTROL] = DIALOG_Register();
   if (!controlAtoms[DIALOG_CONTROL]) dprintf(("failed!!!"));
-
-  dprintf(("Register DESKTOP class"));
-  controlAtoms[DESKTOP_CONTROL] = DESKTOP_Register();
-  if (!controlAtoms[DESKTOP_CONTROL]) dprintf(("failed!!!"));
 
   dprintf(("Register WINSWITCH class"));
Index: trunk/src/user32/dc.cpp
===================================================================
--- trunk/src/user32/dc.cpp	(revision 2581)
+++ trunk/src/user32/dc.cpp	(revision 2582)
@@ -1,3 +1,3 @@
-/* $Id: dc.cpp,v 1.40 2000-01-29 20:46:52 sandervl Exp $ */
+/* $Id: dc.cpp,v 1.41 2000-01-31 22:30:51 sandervl Exp $ */
 
 /*
@@ -68,4 +68,6 @@
 BOOL changePageXForm(Win32BaseWindow *wnd, pDCData pHps, PPOINTL pValue, int x, int y, PPOINTL pPrev);
 LONG clientHeight(Win32BaseWindow *wnd, HWND hwnd, pDCData pHps);
+
+HWND WIN32API GetDesktopWindow(void);
 
 //******************************************************************************
@@ -663,4 +665,10 @@
    BOOL     creatingOwnDC = FALSE;
    PS_Type  psType;
+
+   if(hwnd == 0) {
+	dprintf(("error: GetDCEx window %x not found", hwnd));
+	O32_SetLastError(ERROR_INVALID_WINDOW_HANDLE);
+	return 0;
+   }
 
    if (hwnd)
@@ -683,6 +691,4 @@
                 hWindow = wnd->getOS2WindowHandle();
    }
-   else
-      hWindow = HWND_DESKTOP;
 
    //SvL: Hack for memory.exe (doesn't get repainted properly otherwise)
@@ -809,4 +815,6 @@
 HDC WIN32API GetDC (HWND hwnd)
 {
+  if(!hwnd)
+       return GetDCEx( GetDesktopWindow(), 0, DCX_CACHE_W | DCX_WINDOW_W );
   return GetDCEx (hwnd, NULL, 0);
 }
@@ -815,5 +823,6 @@
 HDC WIN32API GetWindowDC (HWND hwnd)
 {
-  return GetDCEx (hwnd, NULL, DCX_WINDOW_W);
+  if (!hwnd) hwnd = GetDesktopWindow();
+  return GetDCEx (hwnd, NULL, DCX_USESTYLE_W | DCX_WINDOW_W);
 }
 //******************************************************************************
Index: trunk/src/user32/dc.h
===================================================================
--- trunk/src/user32/dc.h	(revision 2581)
+++ trunk/src/user32/dc.h	(revision 2582)
@@ -1,3 +1,3 @@
-/* $Id: dc.h,v 1.10 2000-01-18 20:08:09 sandervl Exp $ */
+/* $Id: dc.h,v 1.11 2000-01-31 22:30:51 sandervl Exp $ */
 /*
  * public dc functions
@@ -95,4 +95,5 @@
 #define DCX_INTERSECTUPDATE_W           0x00000200L
 #define DCX_LOCKWINDOWUPDATE_W          0x00000400L
+#define DCX_USESTYLE_W                  0x00010000L
 #define DCX_VALIDATE_W                  0x00200000L
 
Index: trunk/src/user32/initterm.cpp
===================================================================
--- trunk/src/user32/initterm.cpp	(revision 2581)
+++ trunk/src/user32/initterm.cpp	(revision 2582)
@@ -1,3 +1,3 @@
-/* $Id: initterm.cpp,v 1.18 2000-01-18 20:10:36 sandervl Exp $ */
+/* $Id: initterm.cpp,v 1.19 2000-01-31 22:30:51 sandervl Exp $ */
 
 /*
@@ -115,9 +115,4 @@
          MONITOR_Initialize(&MONITOR_PrimaryMonitor);
 
-         //SvL: Create Desktop Window
-         if(CreateWin32Desktop() == FALSE) {
-                return 0UL;
-         }
-
          break;
       case 1 :
Index: trunk/src/user32/menu.cpp
===================================================================
--- trunk/src/user32/menu.cpp	(revision 2581)
+++ trunk/src/user32/menu.cpp	(revision 2582)
@@ -1,3 +1,3 @@
-/* $Id: menu.cpp,v 1.13 2000-01-30 18:48:27 sandervl Exp $*/
+/* $Id: menu.cpp,v 1.14 2000-01-31 22:30:52 sandervl Exp $*/
 /*
  * Menu functions
@@ -1705,4 +1705,5 @@
 
     //debug_print_menuitem("MENU_SetItemData from: ", item, "");
+
 
     if (IS_STRING_ITEM(flags))
@@ -4125,5 +4126,5 @@
                                  const MENUITEMINFOA *lpmii)
 {
-    dprintf(("USER32: SetMenuItemInfoA"));
+    dprintf(("USER32: SetMenuItemInfoA %x %d %d %x", hmenu, item, bypos, lpmii));
 
     return SetMenuItemInfo_common(MENU_FindItem(&hmenu, &item, bypos? MF_BYPOSITION : 0),
@@ -4244,5 +4245,5 @@
     MENUITEM *item = MENU_InsertItem(hMenu, uItem, bypos ? MF_BYPOSITION : 0 );
 
-    dprintf(("USER32: InsertMenuItemA"));
+    dprintf(("USER32: InsertMenuItemA %x %d %d %x", hMenu, uItem, bypos, lpmii->wID));
 
     return SetMenuItemInfo_common(item, lpmii, FALSE);
Index: trunk/src/user32/oslibwin.h
===================================================================
--- trunk/src/user32/oslibwin.h	(revision 2581)
+++ trunk/src/user32/oslibwin.h	(revision 2582)
@@ -1,3 +1,3 @@
-/* $Id: oslibwin.h,v 1.35 2000-01-18 20:08:12 sandervl Exp $ */
+/* $Id: oslibwin.h,v 1.36 2000-01-31 22:30:52 sandervl Exp $ */
 /*
  * Window API wrappers for OS/2
@@ -30,4 +30,5 @@
 #endif
 
+//SvL: Must be the same as HWND_DESKTOP/OBJECT in pmwin.h!
 #define OSLIB_HWND_DESKTOP      1
 #define OSLIB_HWND_OBJECT       2
