Index: trunk/src/user32/dc.cpp
===================================================================
--- trunk/src/user32/dc.cpp	(revision 2072)
+++ trunk/src/user32/dc.cpp	(revision 2076)
@@ -1,3 +1,3 @@
-/* $Id: dc.cpp,v 1.27 1999-12-07 20:43:39 sandervl Exp $ */
+/* $Id: dc.cpp,v 1.28 1999-12-14 19:13:18 sandervl Exp $ */
 
 /*
@@ -610,9 +610,20 @@
    if (hwnd)
    {
-      wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
-      if (flags & DCX_WINDOW_W)
-         hWindow = wnd->getOS2FrameWindowHandle();
-      else
-         hWindow = wnd->getOS2WindowHandle();
+      	wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
+	if(wnd == NULL) {
+   		dprintf (("ERROR: User32: GetDCEx bad window handle %X!!!!!", hwnd));
+		O32_SetLastError(ERROR_INVALID_WINDOW_HANDLE_W);
+		return 0;
+	}
+//SvL: Experimental change (doesn't work right)
+#if 0
+	if(wnd->fHasParentDC() && wnd->getParent()) {
+		wnd = wnd->getParent();
+	}
+#endif
+      	if (flags & DCX_WINDOW_W)
+         	hWindow = wnd->getOS2FrameWindowHandle();
+      	else
+         	hWindow = wnd->getOS2WindowHandle();
    }
    else
Index: trunk/src/user32/pmwindow.cpp
===================================================================
--- trunk/src/user32/pmwindow.cpp	(revision 2072)
+++ trunk/src/user32/pmwindow.cpp	(revision 2076)
@@ -1,3 +1,3 @@
-/* $Id: pmwindow.cpp,v 1.63 1999-12-05 14:31:41 sandervl Exp $ */
+/* $Id: pmwindow.cpp,v 1.64 1999-12-14 19:13:19 sandervl Exp $ */
 /*
  * Win32 Window Managment Code for OS/2
@@ -781,4 +781,7 @@
 
     case WM_INITMENU:
+	win32wnd->MsgInitMenu((HWND)mp2);
+	break;
+
     case WM_MENUSELECT:
     case WM_MENUEND:
Index: trunk/src/user32/win32class.cpp
===================================================================
--- trunk/src/user32/win32class.cpp	(revision 2072)
+++ trunk/src/user32/win32class.cpp	(revision 2076)
@@ -1,3 +1,3 @@
-/* $Id: win32class.cpp,v 1.9 1999-12-09 11:00:02 sandervl Exp $ */
+/* $Id: win32class.cpp,v 1.10 1999-12-14 19:13:19 sandervl Exp $ */
 /*
  * Win32 Window Class Managment Code for OS/2
@@ -107,4 +107,5 @@
   windowStyle           = wndclass->style;
   WINPROC_SetProc((HWINDOWPROC *)&windowProc, wndclass->lpfnWndProc, (isUnicode) ? WIN_PROC_32W : WIN_PROC_32A, WIN_PROC_CLASS);
+  dprintf2(("Window class ptr %x", windowProc));
 
   //User data class words/longs
@@ -392,4 +393,8 @@
  ULONG rc;
 
+  if(classNameA) {
+  	dprintf2(("Win32WndClass::setClassLongA %s: %d %x", classNameA, index, lNewVal));
+  }
+  else	dprintf2(("Win32WndClass::setClassLongA %d: %d %x", classAtom, index, lNewVal));
   switch(index) {
         case GCL_CBCLSEXTRA: //TODO (doesn't affect allocated classes, so what does it do?)
Index: trunk/src/user32/win32wbase.cpp
===================================================================
--- trunk/src/user32/win32wbase.cpp	(revision 2072)
+++ trunk/src/user32/win32wbase.cpp	(revision 2076)
@@ -1,3 +1,3 @@
-/* $Id: win32wbase.cpp,v 1.109 1999-12-09 10:59:04 sandervl Exp $ */
+/* $Id: win32wbase.cpp,v 1.110 1999-12-14 19:13:19 sandervl Exp $ */
 /*
  * Win32 Window Base Class for OS/2
@@ -147,4 +147,5 @@
   fCreated         = FALSE;
   fTaskList        = FALSE;
+  fParentDC        = FALSE;
 
   windowNameA      = NULL;
@@ -270,4 +271,5 @@
 BOOL Win32BaseWindow::IsWindowUnicode()
 {
+//    dprintf2(("IsWindowUnicode %x %d", getWindowHandle(), WINPROC_GetProcType(getWindowProc()) == WIN_PROC_32W));
     return (WINPROC_GetProcType(getWindowProc()) == WIN_PROC_32W);
 }
@@ -440,5 +442,5 @@
   }
 
-  WINPROC_SetProc((HWINDOWPROC *)&win32wndproc, windowClass->getWindowProc(), (isUnicode) ? WIN_PROC_32W : WIN_PROC_32A, WIN_PROC_WINDOW);
+  WINPROC_SetProc((HWINDOWPROC *)&win32wndproc, windowClass->getWindowProc(), WINPROC_GetProcType(windowClass->getWindowProc()), WIN_PROC_WINDOW);
   hInstance = cs->hInstance;
   dwStyle   = cs->style & ~WS_VISIBLE;
@@ -634,9 +636,10 @@
   if(windowClass->getStyle() & CS_OWNDC) {
     dprintf(("Class with CS_OWNDC style"));
-//  ownDC = GetWindowDC(getWindowHandle());
+//    ownDC = GetWindowDC(getWindowHandle());
   }
   else
   if (windowClass->getStyle() & CS_PARENTDC)  {
     dprintf(("ERROR: Class with CS_PARENTDC style -> NOT IMPLEMENTED!"));
+    fParentDC = TRUE;
     ownDC = 0;
   }
@@ -1221,4 +1224,14 @@
 }
 //******************************************************************************
+//TODO: Depending on menu type, we should send WM_INITMENU or WM_INITPOPUPMENU
+//TODO: PM sends it for each submenu that gets activated; Windows only for the first
+//      submenu; once the menu bar is active, moving the cursor doesn't generate other
+//      WM_INITMENU msgs. Not really a problem, but might need to fix this later on.
+//******************************************************************************
+void Win32BaseWindow::MsgInitMenu(HWND hMenu)
+{
+    SendInternalMessageA(WM_INITMENU, (WPARAM)hMenu, 0);
+}
+//******************************************************************************
 //******************************************************************************
 ULONG Win32BaseWindow::MsgPaint(ULONG tmp1, BOOL select)
@@ -2223,7 +2236,7 @@
                 if(parentwindow) {
                         if(Msg == WM_CREATE || Msg == WM_DESTROY) {
-                                parentwindow->SendMessageA(WM_PARENTNOTIFY, MAKEWPARAM(Msg, window->getWindowId()), (LPARAM)window->getWindowHandle());
+                                parentwindow->SendMessageA(WM_PARENTNOTIFY, MAKEWPARAM(Msg, getWindowId()), (LPARAM)getWindowHandle());
                         }
-                        else    parentwindow->SendMessageA(WM_PARENTNOTIFY, MAKEWPARAM(Msg, window->getWindowId()), lParam );
+                        else    parentwindow->SendMessageA(WM_PARENTNOTIFY, MAKEWPARAM(Msg, getWindowId()), lParam );
                 }
         }
@@ -2974,5 +2987,5 @@
  LONG oldval;
 
-    dprintf2(("SetWindowLongA %x %d %x", getWindowHandle(), index, value));
+    dprintf2(("SetWindowLong%c %x %d %x", (fUnicode) ? 'W' : 'A', getWindowHandle(), index, value));
     switch(index) {
         case GWL_EXSTYLE:
Index: trunk/src/user32/win32wbase.h
===================================================================
--- trunk/src/user32/win32wbase.h	(revision 2072)
+++ trunk/src/user32/win32wbase.h	(revision 2076)
@@ -1,3 +1,3 @@
-/* $Id: win32wbase.h,v 1.52 1999-12-09 00:53:38 sandervl Exp $ */
+/* $Id: win32wbase.h,v 1.53 1999-12-14 19:13:20 sandervl Exp $ */
 /*
  * Win32 Window Base Class for OS/2
@@ -98,5 +98,5 @@
          char  *MsgGetText();
          ULONG  MsgContextMenu(ULONG x,ULONG y);
-
+	 void   MsgInitMenu(HWND hMenu);
          VOID   updateWindowStyle(DWORD oldExStyle,DWORD oldStyle);
 
@@ -121,4 +121,6 @@
 virtual  BOOL   isMDIClient();
 virtual  BOOL   isMDIChild();
+
+	 BOOL   fHasParentDC()                  { return fParentDC; };
 
 Win32BaseWindow *getParent();
@@ -186,5 +188,5 @@
          BOOL   IsWindowVisible();
 	 //Created with CreateWindowExA or ExW
-         BOOL   IsUnicode() 			{ return isUnicode; };
+//         BOOL   IsUnicode() 			{ return isUnicode; };
 	 //Window procedure type
          BOOL   IsWindowUnicode();	
@@ -306,4 +308,5 @@
         BOOL    fCreated;
 	BOOL    fTaskList;		//should be listed in PM tasklist or not
+	BOOL    fParentDC;
 
         PVOID   pOldFrameProc;
Index: trunk/src/user32/win32wmdichild.cpp
===================================================================
--- trunk/src/user32/win32wmdichild.cpp	(revision 2072)
+++ trunk/src/user32/win32wmdichild.cpp	(revision 2076)
@@ -1,3 +1,3 @@
-/* $Id: win32wmdichild.cpp,v 1.10 1999-12-09 00:53:38 sandervl Exp $ */
+/* $Id: win32wmdichild.cpp,v 1.11 1999-12-14 19:13:20 sandervl Exp $ */
 /*
  * Win32 MDI Child Window Class for OS/2
@@ -347,23 +347,12 @@
     className = (LPSTR)cs->szClass;
     /* Find the class atom */
-    if (!(classAtom = (client->IsUnicode() ? GlobalFindAtomW((LPWSTR)cs->szClass) :
-                                             GlobalFindAtomA(cs->szClass))))
-
+    classAtom = GlobalFindAtomA(cs->szClass);
+    if(classAtom == 0)
     {
         if (!HIWORD(cs->szClass))
         {
-            if(!client->IsUnicode())
-            {
-                sprintf(tmpClassA,"#%d", (int) className);
-                classAtom = GlobalFindAtomA(tmpClassA);
-                className = tmpClassA;
-            }
-            else
-            {
-              sprintf(tmpClassA,"#%d", (int) className);
-              AsciiToUnicode(tmpClassA, tmpClassW);
-              classAtom = GlobalFindAtomW(tmpClassW);
-              className = (LPSTR)tmpClassW;
-            }
+            sprintf(tmpClassA,"#%d", (int) className);
+            classAtom = GlobalFindAtomA(tmpClassA);
+            className = tmpClassA;
         }
         if (!classAtom)
@@ -380,5 +369,5 @@
     createstruct.lpszClass = className;
 
-    newchild = new Win32MDIChildWindow(&createstruct, classAtom, client->IsUnicode());
+    newchild = new Win32MDIChildWindow(&createstruct, classAtom, FALSE);
 
     if(newchild && GetLastError() == 0)
