PATCH - comdlg32 more win16/32

Steven Edwards Steven_Ed4153 at yahoo.com
Wed Jun 25 20:13:10 CDT 2003


Hello,
With this patch all of the calls to CallWindowProc16 are gone except in 
the print dialogs. I am unsure about a few small parts of it so a little 
rubbing and a lot of testing would be nice. I hate duplicating all this 
code but I dont really see any other way to do this as I really dont 
understand most of the low level stuff here.

Thanks
Steven

Changelog:
Remove calls to CallWindowProc16 when building as a 32 bit dll.
Create new internal functions CC_WMInitDialog16 CC_WMCommand16.
Share a few other internal functions with the 16 bit commdlg.
-------------- next part --------------
Index: colordlg.h
===================================================================
RCS file: /home/wine/wine/dlls/commdlg/colordlg.h,v
retrieving revision 1.1
diff -u -r1.1 colordlg.h
--- colordlg.h	13 Jun 2003 18:07:45 -0000	1.1
+++ colordlg.h	26 Jun 2003 01:00:46 -0000
@@ -69,12 +69,21 @@
 
 BOOL CC_HookCallChk( LPCHOOSECOLORW lpcc );
 int CC_MouseCheckResultWindow( HWND hDlg, LPARAM lParam );
-LONG CC_WMInitDialog( HWND hDlg, WPARAM wParam, LPARAM lParam, BOOL b16 );
 LRESULT CC_WMLButtonDown( HWND hDlg, WPARAM wParam, LPARAM lParam );
 LRESULT CC_WMLButtonUp( HWND hDlg, WPARAM wParam, LPARAM lParam );
 LRESULT CC_WMCommand( HWND hDlg, WPARAM wParam, LPARAM lParam, WORD 
 						notifyCode, HWND hwndCtl );
 LRESULT CC_WMMouseMove( HWND hDlg, LPARAM lParam );
 LRESULT CC_WMPaint( HWND hDlg, WPARAM wParam, LPARAM lParam );
+int CC_RGBtoHSL(char c, int r, int g, int b);
+void CC_SwitchToFullSize( HWND hDlg, COLORREF result, LPRECT lprect );
+void CC_PaintSelectedColor( HWND hDlg, COLORREF cr );
+void CC_PaintCross( HWND hDlg, int x, int y);
+void CC_PaintTriangle( HWND hDlg, int y);
+void CC_EditSetHSL( HWND hDlg, int h, int s, int l );
+int CC_HSLtoRGB(char c, int hue, int sat, int lum);
+void CC_EditSetRGB( HWND hDlg, COLORREF cr );
+int CC_CheckDigitsInEdit( HWND hwnd, int maxval );
+void CC_PaintUserColorArray( HWND hDlg, int rows, int cols, COLORREF* lpcr );
 
 #endif /* _WINE_COLORDLG_H */

Index: colordlg.c
===================================================================
RCS file: /home/wine/wine/dlls/commdlg/colordlg.c,v
retrieving revision 1.41
diff -u -r1.41 colordlg.c
--- colordlg.c	13 Jun 2003 18:07:45 -0000	1.41
+++ colordlg.c	26 Jun 2003 01:00:53 -0000
@@ -67,7 +67,7 @@
 /***********************************************************************
  *                             CC_HSLtoRGB                    [internal]
  */
-static int CC_HSLtoRGB(char c, int hue, int sat, int lum)
+int CC_HSLtoRGB(char c, int hue, int sat, int lum)
 {
  int res = 0, maxrgb;
 
@@ -112,7 +112,7 @@
 /***********************************************************************
  *                             CC_RGBtoHSL                    [internal]
  */
-static int CC_RGBtoHSL(char c, int r, int g, int b)
+int CC_RGBtoHSL(char c, int r, int g, int b)
 {
  WORD maxi, mini, mmsum, mmdif, result = 0;
  int iresult = 0;
@@ -355,7 +355,7 @@
 /***********************************************************************
  *                       CC_CheckDigitsInEdit                 [internal]
  */
-static int CC_CheckDigitsInEdit( HWND hwnd, int maxval )
+int CC_CheckDigitsInEdit( HWND hwnd, int maxval )
 {
  int i, k, m, result, value;
  long editpos;
@@ -397,7 +397,7 @@
 /***********************************************************************
  *                    CC_PaintSelectedColor                   [internal]
  */
-static void CC_PaintSelectedColor( HWND hDlg, COLORREF cr )
+void CC_PaintSelectedColor( HWND hDlg, COLORREF cr )
 {
  RECT rect;
  HDC  hdc;
@@ -428,7 +428,7 @@
 /***********************************************************************
  *                    CC_PaintTriangle                        [internal]
  */
-static void CC_PaintTriangle( HWND hDlg, int y)
+void CC_PaintTriangle( HWND hDlg, int y)
 {
  HDC hDC;
  long temp;
@@ -471,7 +471,7 @@
 /***********************************************************************
  *                    CC_PaintCross                           [internal]
  */
-static void CC_PaintCross( HWND hDlg, int x, int y)
+void CC_PaintCross( HWND hDlg, int x, int y)
 {
  HDC hDC;
  int w = GetDialogBaseUnits();
@@ -621,7 +621,7 @@
 /***********************************************************************
  *                             CC_EditSetRGB                  [internal]
  */
-static void CC_EditSetRGB( HWND hDlg, COLORREF cr )
+void CC_EditSetRGB( HWND hDlg, COLORREF cr )
 {
  char buffer[10];
  LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER);
@@ -644,7 +644,7 @@
 /***********************************************************************
  *                             CC_EditSetHSL                  [internal]
  */
-static void CC_EditSetHSL( HWND hDlg, int h, int s, int l )
+void CC_EditSetHSL( HWND hDlg, int h, int s, int l )
 {
  char buffer[10];
  LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER);
@@ -666,7 +666,7 @@
 /***********************************************************************
  *                       CC_SwitchToFullSize                  [internal]
  */
-static void CC_SwitchToFullSize( HWND hDlg, COLORREF result, LPRECT lprect )
+void CC_SwitchToFullSize( HWND hDlg, COLORREF result, LPRECT lprect )
 {
  int i;
  LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER);
@@ -740,7 +740,7 @@
  *                             CC_PaintUserColorArray         [internal]
  *               Paint the 16 user-selected colors
  */
-static void CC_PaintUserColorArray( HWND hDlg, int rows, int cols, COLORREF* lpcr )
+void CC_PaintUserColorArray( HWND hDlg, int rows, int cols, COLORREF* lpcr )
 {
  HWND hwnd = GetDlgItem(hDlg, 0x2d1);
  RECT rect;
@@ -799,7 +799,7 @@
 /***********************************************************************
  *                              CC_WMInitDialog                  [internal]
  */
-LONG CC_WMInitDialog( HWND hDlg, WPARAM wParam, LPARAM lParam, BOOL b16 )
+LONG CC_WMInitDialog( HWND hDlg, WPARAM wParam, LPARAM lParam)
 {
    int i, res;
    int r, g, b;
@@ -810,28 +810,7 @@
 
    TRACE("WM_INITDIALOG lParam=%08lX\n", lParam);
    lpp = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct CCPRIVATE) );
-   if (b16)
-   {
-       CHOOSECOLORW *ch32;
-       CHOOSECOLOR16 *ch16 = (CHOOSECOLOR16 *) lParam;
-       ch32 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CHOOSECOLORW) );
-       lpp->lpcc = ch32;
-       lpp->lpcc16 = ch16;
-       if (lpp->lpcc16->lStructSize != sizeof(CHOOSECOLOR16) )
-       {
-           EndDialog (hDlg, 0) ;
-           return FALSE;
-       }
-       ch32->lStructSize = sizeof(CHOOSECOLORW);
-       ch32->hwndOwner = HWND_32(ch16->hwndOwner);
-       /* Should be an HINSTANCE but MS made a typo */
-       ch32->hInstance = HWND_32(ch16->hInstance);
-       ch32->lpCustColors = MapSL(ch16->lpCustColors);
-       ch32->lpfnHook = (LPCCHOOKPROC) ch16->lpfnHook; /* only used as flag */
-       ch32->Flags = ch16->Flags;
-   }
-   else
-       lpp->lpcc = (LPCHOOSECOLORW) lParam;
+   lpp->lpcc = (LPCHOOSECOLORW) lParam;
 
    if (lpp->lpcc->lStructSize != sizeof(CHOOSECOLORW) )
    {
@@ -895,10 +874,6 @@
      SendMessageA( GetDlgItem(hDlg, i), EM_LIMITTEXT, 3, 0);  /* max 3 digits:  xyz  */
    if (CC_HookCallChk(lpp->lpcc))
    {
-      if (b16)
-          res = CallWindowProc16( (WNDPROC16)lpp->lpcc16->lpfnHook,
-				  HWND_16(hDlg), WM_INITDIALOG, wParam, lParam);
-      else
           res = CallWindowProcA( (WNDPROC)lpp->lpcc->lpfnHook, hDlg, WM_INITDIALOG, wParam, lParam);
    }
 
@@ -1029,16 +1004,7 @@
 
 	  case 0x40e:           /* Help! */ /* The Beatles, 1965  ;-) */
 	       i = RegisterWindowMessageA(HELPMSGSTRINGA);
-               if (lpp->lpcc16)
-               {
-                   if (lpp->lpcc->hwndOwner)
-		       SendMessageA(lpp->lpcc->hwndOwner, i, 0, (LPARAM)lpp->lpcc16);
-                   if ( CC_HookCallChk(lpp->lpcc))
-		       CallWindowProc16( (WNDPROC16) lpp->lpcc16->lpfnHook,
-					 HWND_16(hDlg), WM_COMMAND, psh15,
-					 (LPARAM)lpp->lpcc16);
-               }
-               else
+               if (lpp->lpcc)
                {
                    if (lpp->lpcc->hwndOwner)
 		       SendMessageA(lpp->lpcc->hwndOwner, i, 0, (LPARAM)lpp->lpcc);
@@ -1050,24 +1016,12 @@
 
           case IDOK :
 		cokmsg = RegisterWindowMessageA(COLOROKSTRINGA);
-                if (lpp->lpcc16)
-                {
-		    if (lpp->lpcc->hwndOwner)
-			if (SendMessageA(lpp->lpcc->hwndOwner, cokmsg, 0, (LPARAM)lpp->lpcc16))
-			   break;    /* do NOT close */
-                }
-                else
-                {
+		if (lpp->lpcc)
+		{
 		    if (lpp->lpcc->hwndOwner)
-			if (SendMessageA(lpp->lpcc->hwndOwner, cokmsg, 0, (LPARAM)lpp->lpcc))
-			   break;    /* do NOT close */
-                }
-                if (lpp->lpcc16)
-                {
-                    BYTE *ptr = MapSL(lpp->lpcc16->lpCustColors);
-                    memcpy(ptr, lpp->lpcc->lpCustColors, sizeof(COLORREF)*16);
-                    lpp->lpcc16->rgbResult = lpp->lpcc->rgbResult;
-                }
+                    	if (SendMessageA(lpp->lpcc->hwndOwner, cokmsg, 0, (LPARAM)lpp->lpcc))
+	            		break;    /* do NOT close */
+		}
 		EndDialog(hDlg, 1) ;
 		return TRUE ;
 
@@ -1240,7 +1194,7 @@
  switch (message)
 	{
 	  case WM_INITDIALOG:
-	                return CC_WMInitDialog(hDlg, wParam, lParam, FALSE);
+	                return CC_WMInitDialog(hDlg, wParam, lParam);
 	  case WM_NCDESTROY:
 	                DeleteDC(lpp->hdcMem);
 	                DeleteObject(lpp->hbmMem);

Index: colordlg16.c
===================================================================
RCS file: /home/wine/wine/dlls/commdlg/colordlg16.c,v
retrieving revision 1.1
diff -u -r1.1 colordlg16.c
--- colordlg16.c	13 Jun 2003 18:07:45 -0000	1.1
+++ colordlg16.c	26 Jun 2003 01:01:00 -0000
@@ -43,6 +43,267 @@
 #include "colordlg.h"
 
 /***********************************************************************
+ *                              CC_WMInitDialog16                [internal]
+ */
+LONG CC_WMInitDialog16( HWND hDlg, WPARAM wParam, LPARAM lParam)
+{
+   int i, res;
+   int r, g, b;
+   HWND hwnd;
+   RECT rect;
+   POINT point;
+   LCCPRIV lpp;
+
+   TRACE("WM_INITDIALOG lParam=%08lX\n", lParam);
+   lpp = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct CCPRIVATE) );
+
+   CHOOSECOLORW *ch32;
+   CHOOSECOLOR16 *ch16 = (CHOOSECOLOR16 *) lParam;
+   ch32 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CHOOSECOLORW) );
+   lpp->lpcc = ch32;
+   lpp->lpcc16 = ch16;
+   if (lpp->lpcc16->lStructSize != sizeof(CHOOSECOLOR16) )
+    {
+        EndDialog (hDlg, 0) ;
+        return FALSE;
+    }
+   ch32->lStructSize = sizeof(CHOOSECOLORW);
+   ch32->hwndOwner = HWND_32(ch16->hwndOwner);
+   /* Should be an HINSTANCE but MS made a typo */
+   ch32->hInstance = HWND_32(ch16->hInstance);
+   ch32->lpCustColors = MapSL(ch16->lpCustColors);
+   ch32->lpfnHook = (LPCCHOOKPROC) ch16->lpfnHook; /* only used as flag */
+   ch32->Flags = ch16->Flags;
+
+   if (lpp->lpcc->lStructSize != sizeof(CHOOSECOLORW) )
+   {
+      EndDialog (hDlg, 0) ;
+      return FALSE;
+   }
+   SetWindowLongA(hDlg, DWL_USER, (LONG)lpp);
+
+   if (!(lpp->lpcc->Flags & CC_SHOWHELP))
+      ShowWindow( GetDlgItem(hDlg,0x40e), SW_HIDE);
+   lpp->msetrgb = RegisterWindowMessageA(SETRGBSTRINGA);
+
+#if 0
+   cpos = MAKELONG(5,7); /* init */
+   if (lpp->lpcc->Flags & CC_RGBINIT)
+   {
+     for (i = 0; i < 6; i++)
+       for (j = 0; j < 8; j++)
+        if (predefcolors[i][j] == lpp->lpcc->rgbResult)
+        {
+          cpos = MAKELONG(i,j);
+          goto found;
+        }
+   }
+   found:
+   /* FIXME: Draw_a_focus_rect & set_init_values */
+#endif
+
+   GetWindowRect(hDlg, &lpp->fullsize);
+   if (lpp->lpcc->Flags & CC_FULLOPEN || lpp->lpcc->Flags & CC_PREVENTFULLOPEN)
+   {
+      hwnd = GetDlgItem(hDlg, 0x2cf);
+      EnableWindow(hwnd, FALSE);
+   }
+   if (!(lpp->lpcc->Flags & CC_FULLOPEN ) || lpp->lpcc->Flags & CC_PREVENTFULLOPEN)
+   {
+      rect = lpp->fullsize;
+      res = rect.bottom - rect.top;
+      hwnd = GetDlgItem(hDlg, 0x2c6); /* cut at left border */
+      point.x = point.y = 0;
+      ClientToScreen(hwnd, &point);
+      ScreenToClient(hDlg,&point);
+      GetClientRect(hDlg, &rect);
+      point.x += GetSystemMetrics(SM_CXDLGFRAME);
+      SetWindowPos(hDlg, 0, 0, 0, point.x, res, SWP_NOMOVE|SWP_NOZORDER);
+
+      for (i = 0x2bf; i < 0x2c5; i++)
+         ShowWindow( GetDlgItem(hDlg, i), SW_HIDE);
+      for (i = 0x2d3; i < 0x2d9; i++)
+         ShowWindow( GetDlgItem(hDlg, i), SW_HIDE);
+      ShowWindow( GetDlgItem(hDlg, 0x2c9), SW_HIDE);
+      ShowWindow( GetDlgItem(hDlg, 0x2c8), SW_HIDE);
+      ShowWindow( GetDlgItem(hDlg, 0x2c6), SW_HIDE);
+      ShowWindow( GetDlgItem(hDlg, 0x2c5), SW_HIDE);
+      ShowWindow( GetDlgItem(hDlg, 1090 ), SW_HIDE);
+   }
+   else
+      CC_SwitchToFullSize(hDlg, lpp->lpcc->rgbResult, NULL);
+   res = TRUE;
+   for (i = 0x2bf; i < 0x2c5; i++)
+     SendMessageA( GetDlgItem(hDlg, i), EM_LIMITTEXT, 3, 0);  /* max 3 digits:  xyz  */
+   if (CC_HookCallChk(lpp->lpcc))
+   {
+         res = CallWindowProc16( (WNDPROC16)lpp->lpcc16->lpfnHook,
+			  HWND_16(hDlg), WM_INITDIALOG, wParam, lParam);
+   }
+
+   /* Set the initial values of the color chooser dialog */
+   r = GetRValue(lpp->lpcc->rgbResult);
+   g = GetGValue(lpp->lpcc->rgbResult);
+   b = GetBValue(lpp->lpcc->rgbResult);
+
+   CC_PaintSelectedColor(hDlg, lpp->lpcc->rgbResult);
+   lpp->h = CC_RGBtoHSL('H', r, g, b);
+   lpp->s = CC_RGBtoHSL('S', r, g, b);
+   lpp->l = CC_RGBtoHSL('L', r, g, b);
+
+   /* Doing it the long way because CC_EditSetRGB/HSL doesn't seem to work */
+   SetDlgItemInt(hDlg, 703, lpp->h, TRUE);
+   SetDlgItemInt(hDlg, 704, lpp->s, TRUE);
+   SetDlgItemInt(hDlg, 705, lpp->l, TRUE);
+   SetDlgItemInt(hDlg, 706, r, TRUE);
+   SetDlgItemInt(hDlg, 707, g, TRUE);
+   SetDlgItemInt(hDlg, 708, b, TRUE);
+
+   CC_PaintCross(hDlg, lpp->h, lpp->s);
+   CC_PaintTriangle(hDlg, lpp->l);
+
+   return res;
+}
+
+/***********************************************************************
+ *                              CC_WMCommand16                  [internal]
+ */
+LRESULT CC_WMCommand16( HWND hDlg, WPARAM wParam, LPARAM lParam, WORD notifyCode, HWND hwndCtl )
+{
+    int  r, g, b, i, xx;
+    UINT cokmsg;
+    HDC hdc;
+    COLORREF *cr;
+    LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER);
+    TRACE("CC_WMCommand wParam=%x lParam=%lx\n", wParam, lParam);
+    switch (wParam)
+    {
+          case 0x2c2:  /* edit notify RGB */
+	  case 0x2c3:
+	  case 0x2c4:
+	       if (notifyCode == EN_UPDATE && !lpp->updating)
+			 {
+			   i = CC_CheckDigitsInEdit(hwndCtl, 255);
+			   r = GetRValue(lpp->lpcc->rgbResult);
+			   g = GetGValue(lpp->lpcc->rgbResult);
+			   b= GetBValue(lpp->lpcc->rgbResult);
+			   xx = 0;
+			   switch (wParam)
+			   {
+			    case 0x2c2: if ((xx = (i != r))) r = i; break;
+			    case 0x2c3: if ((xx = (i != g))) g = i; break;
+			    case 0x2c4: if ((xx = (i != b))) b = i; break;
+			   }
+			   if (xx) /* something has changed */
+			   {
+			    lpp->lpcc->rgbResult = RGB(r, g, b);
+			    CC_PaintSelectedColor(hDlg, lpp->lpcc->rgbResult);
+			    lpp->h = CC_RGBtoHSL('H', r, g, b);
+			    lpp->s = CC_RGBtoHSL('S', r, g, b);
+			    lpp->l = CC_RGBtoHSL('L', r, g, b);
+			    CC_EditSetHSL(hDlg, lpp->h, lpp->s, lpp->l);
+			    CC_PaintCross(hDlg, lpp->h, lpp->s);
+			    CC_PaintTriangle(hDlg, lpp->l);
+			   }
+			 }
+		 break;
+
+	  case 0x2bf:  /* edit notify HSL */
+	  case 0x2c0:
+	  case 0x2c1:
+	       if (notifyCode == EN_UPDATE && !lpp->updating)
+			 {
+			   i = CC_CheckDigitsInEdit(hwndCtl , wParam == 0x2bf ? 239:240);
+			   xx = 0;
+			   switch (wParam)
+			   {
+			    case 0x2bf: if ((xx = ( i != lpp->h))) lpp->h = i; break;
+			    case 0x2c0: if ((xx = ( i != lpp->s))) lpp->s = i; break;
+			    case 0x2c1: if ((xx = ( i != lpp->l))) lpp->l = i; break;
+			   }
+			   if (xx) /* something has changed */
+			   {
+			    r = CC_HSLtoRGB('R', lpp->h, lpp->s, lpp->l);
+			    g = CC_HSLtoRGB('G', lpp->h, lpp->s, lpp->l);
+			    b = CC_HSLtoRGB('B', lpp->h, lpp->s, lpp->l);
+			    lpp->lpcc->rgbResult = RGB(r, g, b);
+			    CC_PaintSelectedColor(hDlg, lpp->lpcc->rgbResult);
+			    CC_EditSetRGB(hDlg, lpp->lpcc->rgbResult);
+			    CC_PaintCross(hDlg, lpp->h, lpp->s);
+			    CC_PaintTriangle(hDlg, lpp->l);
+			   }
+			 }
+	       break;
+
+          case 0x2cf:
+               CC_SwitchToFullSize(hDlg, lpp->lpcc->rgbResult, &lpp->fullsize);
+	       SetFocus( GetDlgItem(hDlg, 0x2bf));
+	       break;
+
+          case 0x2c8:    /* add colors ... column by column */
+               cr = lpp->lpcc->lpCustColors;
+               cr[(lpp->nextuserdef % 2) * 8 + lpp->nextuserdef / 2] = lpp->lpcc->rgbResult;
+               if (++lpp->nextuserdef == 16)
+		   lpp->nextuserdef = 0;
+	       CC_PaintUserColorArray(hDlg, 2, 8, lpp->lpcc->lpCustColors);
+	       break;
+
+          case 0x2c9:              /* resulting color */
+	       hdc = GetDC(hDlg);
+	       lpp->lpcc->rgbResult = GetNearestColor(hdc, lpp->lpcc->rgbResult);
+	       ReleaseDC(hDlg, hdc);
+	       CC_EditSetRGB(hDlg, lpp->lpcc->rgbResult);
+	       CC_PaintSelectedColor(hDlg, lpp->lpcc->rgbResult);
+	       r = GetRValue(lpp->lpcc->rgbResult);
+	       g = GetGValue(lpp->lpcc->rgbResult);
+	       b = GetBValue(lpp->lpcc->rgbResult);
+	       lpp->h = CC_RGBtoHSL('H', r, g, b);
+	       lpp->s = CC_RGBtoHSL('S', r, g, b);
+	       lpp->l = CC_RGBtoHSL('L', r, g, b);
+	       CC_EditSetHSL(hDlg, lpp->h, lpp->s, lpp->l);
+	       CC_PaintCross(hDlg, lpp->h, lpp->s);
+	       CC_PaintTriangle(hDlg, lpp->l);
+	       break;
+
+	  case 0x40e:           /* Help! */ /* The Beatles, 1965  ;-) */
+	       i = RegisterWindowMessageA(HELPMSGSTRINGA);
+               if (lpp->lpcc16)
+               {
+                   if (lpp->lpcc->hwndOwner)
+		       SendMessageA(lpp->lpcc->hwndOwner, i, 0, (LPARAM)lpp->lpcc16);
+                   if ( CC_HookCallChk(lpp->lpcc))
+		       CallWindowProc16( (WNDPROC16) lpp->lpcc16->lpfnHook,
+					 HWND_16(hDlg), WM_COMMAND, psh15,
+					 (LPARAM)lpp->lpcc16);
+               }
+	       break;
+
+          case IDOK :
+		cokmsg = RegisterWindowMessageA(COLOROKSTRINGA);
+                if (lpp->lpcc16)
+                {
+		    if (lpp->lpcc->hwndOwner)
+			if (SendMessageA(lpp->lpcc->hwndOwner, cokmsg, 0, (LPARAM)lpp->lpcc16))
+			   break;    /* do NOT close */
+                }
+                if (lpp->lpcc16)
+                {
+                    BYTE *ptr = MapSL(lpp->lpcc16->lpCustColors);
+                    memcpy(ptr, lpp->lpcc->lpCustColors, sizeof(COLORREF)*16);
+                    lpp->lpcc16->rgbResult = lpp->lpcc->rgbResult;
+                }
+		EndDialog(hDlg, 1) ;
+		return TRUE ;
+
+	  case IDCANCEL :
+		EndDialog(hDlg, 0) ;
+		return TRUE ;
+
+       }
+       return FALSE;
+}
+
+/***********************************************************************
  *           ColorDlgProc   (COMMDLG.8)
  */
 BOOL16 CALLBACK ColorDlgProc16( HWND16 hDlg16, UINT16 message,
@@ -71,7 +332,7 @@
     switch (message)
     {
 	  case WM_INITDIALOG:
-	                return CC_WMInitDialog(hDlg, wParam, lParam, TRUE);
+	                return CC_WMInitDialog16(hDlg, wParam, lParam);
 	  case WM_NCDESTROY:
 	                DeleteDC(lpp->hdcMem);
 	                DeleteObject(lpp->hbmMem);
@@ -80,7 +341,7 @@
 	                SetWindowLongA(hDlg, DWL_USER, 0L); /* we don't need it anymore */
 	                break;
 	  case WM_COMMAND:
-	                if (CC_WMCommand(hDlg, wParam, lParam,
+	                if (CC_WMCommand16(hDlg, wParam, lParam,
 					 HIWORD(lParam), HWND_32(LOWORD(lParam))))
 	                   return TRUE;
 	                break;



More information about the wine-devel mailing list