monthcal: handle the notification window properly

Dimitrie O. Paun dpaun at rogers.com
Wed Nov 19 14:02:33 CST 2003


ChangeLog
    Make monthcal send its notifications to the parent window passed
    to it in CREATESTRUCT.  Based on a treeview patch by Igor Grahek.

Index: dlls/comctl32/monthcal.c
===================================================================
RCS file: /var/cvs/wine/dlls/comctl32/monthcal.c,v
retrieving revision 1.42
diff -u -r1.42 monthcal.c
--- dlls/comctl32/monthcal.c	22 Sep 2003 21:32:33 -0000	1.42
+++ dlls/comctl32/monthcal.c	19 Nov 2003 05:35:32 -0000
@@ -104,6 +104,7 @@
     RECT days;		/* calendar area */
     RECT weeknums;	/* week numbers at left side */
     RECT todayrect;	/* `today: xx/xx/xx' text rect */
+    HWND hwndNotify;    /* Window to receive the notifications */
     HWND hWndYearEdit;  /* Window Handle of edit box to handle years */
     HWND hWndYearUpDown;/* Window Handle of updown box to handle years */
 } MONTHCAL_INFO, *LPMONTHCAL_INFO;
@@ -1304,7 +1305,7 @@
     nmds.cDayState	= infoPtr->monthRange;
     nmds.prgDayState	= Alloc(infoPtr->monthRange * sizeof(MONTHDAYSTATE));
 
-    SendMessageA(GetParent(hwnd), WM_NOTIFY,
+    SendMessageA(infoPtr->hwndNotify, WM_NOTIFY,
     (WPARAM)nmds.nmhdr.idFrom, (LPARAM)&nmds);
     for(i=0; i<infoPtr->monthRange; i++)
       infoPtr->monthdayState[i] = nmds.prgDayState[i];
@@ -1335,7 +1336,7 @@
     nmds.prgDayState	= Alloc
                         (infoPtr->monthRange * sizeof(MONTHDAYSTATE));
 
-    SendMessageA(GetParent(hwnd), WM_NOTIFY,
+    SendMessageA(infoPtr->hwndNotify, WM_NOTIFY,
         (WPARAM)nmds.nmhdr.idFrom, (LPARAM)&nmds);
     for(i=0; i<infoPtr->monthRange; i++)
        infoPtr->monthdayState[i] = nmds.prgDayState[i];
@@ -1489,7 +1490,7 @@
     MONTHCAL_CopyTime(&nmsc.stSelStart, &infoPtr->minSel);
     MONTHCAL_CopyTime(&nmsc.stSelEnd, &infoPtr->maxSel);
 
-    SendMessageA(GetParent(hwnd), WM_NOTIFY,
+    SendMessageA(infoPtr->hwndNotify, WM_NOTIFY,
            (WPARAM)nmsc.nmhdr.idFrom,(LPARAM)&nmsc);
 
     MONTHCAL_CopyTime(&ht.st, &selArray[0]);
@@ -1555,9 +1556,9 @@
   nmhdr.hwndFrom = hwnd;
   nmhdr.idFrom   = GetWindowLongA( hwnd, GWL_ID);
   nmhdr.code     = NM_RELEASEDCAPTURE;
-  TRACE("Sent notification from %p to %p\n", hwnd, GetParent(hwnd));
+  TRACE("Sent notification from %p to %p\n", hwnd, infoPtr->hwndNotify);
 
-  SendMessageA(GetParent(hwnd), WM_NOTIFY,
+  SendMessageA(infoPtr->hwndNotify, WM_NOTIFY,
                                 (WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr);
 
   nmsc.nmhdr.hwndFrom = hwnd;
@@ -1566,7 +1567,7 @@
   MONTHCAL_CopyTime(&nmsc.stSelStart, &infoPtr->minSel);
   MONTHCAL_CopyTime(&nmsc.stSelEnd, &infoPtr->maxSel);
 
-  SendMessageA(GetParent(hwnd), WM_NOTIFY,
+  SendMessageA(infoPtr->hwndNotify, WM_NOTIFY,
            (WPARAM)nmsc.nmhdr.idFrom, (LPARAM)&nmsc);
 
   /* redraw if necessary */
@@ -1880,6 +1881,8 @@
     ERR( "pointer assignment error!\n");
     return 0;
   }
+
+  infoPtr->hwndNotify = ((LPCREATESTRUCTW)lParam)->hwndParent;
 
   infoPtr->hFont = GetStockObject(DEFAULT_GUI_FONT);
   GetObjectA(infoPtr->hFont, sizeof(LOGFONTA), &logFont);

-- 
Dimi.




More information about the wine-patches mailing list