Make the controls send notifications to the parent window passed to them in CREATESTRUCT. Based on a treeview patch by Igor Grahek.
diff --git a/dlls/comctl32/animate.c b/dlls/comctl32/animate.c index 4c7a3cb..35c126f 100644 --- a/dlls/comctl32/animate.c +++ b/dlls/comctl32/animate.c
@@ -57,7 +57,8 @@ /* reference to input stream (file or resource) */ HGLOBAL hRes; HMMIO hMMio; /* handle to mmio stream */ - HWND hWnd; + HWND hwndSelf; + HWND hwndNotify; /* information on the loaded AVI file */ MainAVIHeader mah; AVIStreamHeader ash; @@ -88,9 +89,9 @@ static void ANIMATE_Notify(ANIMATE_INFO* infoPtr, UINT notif) { - SendMessageA(GetParent(infoPtr->hWnd), WM_COMMAND, - MAKEWPARAM(GetDlgCtrlID(infoPtr->hWnd), notif), - (LPARAM)infoPtr->hWnd); + SendMessageA(infoPtr->hwndNotify, WM_COMMAND, + MAKEWPARAM(GetDlgCtrlID(infoPtr->hwndSelf), notif), + (LPARAM)infoPtr->hwndSelf); } static BOOL ANIMATE_LoadResA(ANIMATE_INFO *infoPtr, HINSTANCE hInst, LPSTR lpName) @@ -149,7 +150,7 @@ infoPtr->hThread = 0; } if (infoPtr->uTimer) { - KillTimer(infoPtr->hWnd, infoPtr->uTimer); + KillTimer(infoPtr->hwndSelf, infoPtr->uTimer); infoPtr->uTimer = 0; } @@ -202,7 +203,7 @@ infoPtr->hbmPrevFrame = 0; } infoPtr->indata = infoPtr->outdata = NULL; - infoPtr->hWnd = 0; + infoPtr->hwndSelf = 0; infoPtr->hMMio = 0; memset(&infoPtr->mah, 0, sizeof(infoPtr->mah)); @@ -297,7 +298,7 @@ infoPtr->transparentColor = GetPixel(hdcMem,0,0); } - if(GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_TRANSPARENT) + if(GetWindowLongA(infoPtr->hwndSelf, GWL_STYLE) & ACS_TRANSPARENT) { HDC hdcFinal = CreateCompatibleDC(hDC); HBITMAP hbmFinal = CreateCompatibleBitmap(hDC,nWidth, nHeight); @@ -322,11 +323,11 @@ infoPtr->hbmPrevFrame = hbmFinal; } - if (GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_CENTER) + if (GetWindowLongA(infoPtr->hwndSelf, GWL_STYLE) & ACS_CENTER) { RECT rect; - GetWindowRect(infoPtr->hWnd, &rect); + GetWindowRect(infoPtr->hwndSelf, &rect); nOffsetX = ((rect.right - rect.left) - nWidth)/2; nOffsetY = ((rect.bottom - rect.top) - nHeight)/2; } @@ -356,9 +357,9 @@ return FALSE; } - if ((hDC = GetDC(infoPtr->hWnd)) != 0) { + if ((hDC = GetDC(infoPtr->hwndSelf)) != 0) { ANIMATE_PaintFrame(infoPtr, hDC); - ReleaseDC(infoPtr->hWnd, hDC); + ReleaseDC(infoPtr->hwndSelf, hDC); } if (infoPtr->currFrame++ >= infoPtr->nToFrame) { @@ -387,15 +388,15 @@ while(1) { - if(GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_TRANSPARENT) + if(GetWindowLongA(infoPtr->hwndSelf, GWL_STYLE) & ACS_TRANSPARENT) { - hDC = GetDC(infoPtr->hWnd); + hDC = GetDC(infoPtr->hwndSelf); /* sometimes the animation window will be destroyed in between * by the main program, so a ReleaseDC() error msg is possible */ - infoPtr->hbrushBG = (HBRUSH)SendMessageA(GetParent(infoPtr->hWnd), + infoPtr->hbrushBG = (HBRUSH)SendMessageA(infoPtr->hwndNotify, WM_CTLCOLORSTATIC, (WPARAM)hDC, - (LPARAM)infoPtr->hWnd); - ReleaseDC(infoPtr->hWnd,hDC); + (LPARAM)infoPtr->hwndSelf); + ReleaseDC(infoPtr->hwndSelf,hDC); } EnterCriticalSection(&infoPtr->cs); @@ -689,7 +690,7 @@ HINSTANCE hInstance = (HINSTANCE)wParam; ANIMATE_Free(infoPtr); - infoPtr->hWnd = hWnd; + infoPtr->hwndSelf = hWnd; if (!lParam) { TRACE("Closing avi!\n"); @@ -787,14 +788,15 @@ return 0; } - TRACE("Animate style=0x%08lx, parent=%08lx\n", GetWindowLongA(hWnd, GWL_STYLE), (DWORD)GetParent(hWnd)); - /* store crossref hWnd <-> info structure */ SetWindowLongA(hWnd, 0, (DWORD)infoPtr); - infoPtr->hWnd = hWnd; + infoPtr->hwndSelf = hWnd; + infoPtr->hwndNotify = ((LPCREATESTRUCTA)lParam)->hwndParent; infoPtr->transparentColor = ANIMATE_COLOR_NONE; infoPtr->hbmPrevFrame = 0; + TRACE("Animate style=0x%08lx, parent=%08lx\n", GetWindowLongA(hWnd, GWL_STYLE), (DWORD)infoPtr->hwndNotify); + InitializeCriticalSection(&infoPtr->cs); return 0; @@ -819,12 +821,13 @@ static LRESULT ANIMATE_EraseBackground(HWND hWnd, WPARAM wParam, LPARAM lParam) { + ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hWnd); RECT rect; HBRUSH hBrush = 0; if(GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT) { - hBrush = (HBRUSH)SendMessageA(GetParent(hWnd),WM_CTLCOLORSTATIC, + hBrush = (HBRUSH)SendMessageA(infoPtr->hwndNotify,WM_CTLCOLORSTATIC, wParam, (LPARAM)hWnd); } @@ -882,7 +885,7 @@ if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT) { ANIMATE_INFO* infoPtr = ANIMATE_GetInfoPtr(hWnd); - infoPtr->hbrushBG = (HBRUSH)SendMessageA(GetParent(hWnd), + infoPtr->hbrushBG = (HBRUSH)SendMessageA(infoPtr->hwndNotify, WM_CTLCOLORSTATIC, wParam, (LPARAM)hWnd); } @@ -902,7 +905,7 @@ return DefWindowProcA(hWnd, uMsg, wParam, lParam); if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT) - infoPtr->hbrushBG = (HBRUSH)SendMessageA(GetParent(hWnd), + infoPtr->hbrushBG = (HBRUSH)SendMessageA(infoPtr->hwndNotify, WM_CTLCOLORSTATIC, wParam, (LPARAM)hWnd);
diff --git a/dlls/comctl32/comboex.c b/dlls/comctl32/comboex.c index 9c288f6..dffb15a 100644 --- a/dlls/comctl32/comboex.c +++ b/dlls/comctl32/comboex.c
@@ -64,6 +64,7 @@ { HIMAGELIST himl; HWND hwndSelf; /* my own hwnd */ + HWND hwndNotify; /* my parent hwnd */ HWND hwndCombo; HWND hwndEdit; WNDPROC prevEditWndProc; /* previous Edit WNDPROC value */ @@ -190,11 +191,9 @@ hdr->hwndFrom = infoPtr->hwndSelf; hdr->code = code; if (infoPtr->NtfUnicode) - return SendMessageW (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0, - (LPARAM)hdr); + return SendMessageW (infoPtr->hwndNotify, WM_NOTIFY, 0, (LPARAM)hdr); else - return SendMessageA (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0, - (LPARAM)hdr); + return SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, 0, (LPARAM)hdr); } @@ -935,8 +934,9 @@ infoPtr->selected = -1; infoPtr->unicode = IsWindowUnicode (hwnd); + infoPtr->hwndNotify = cs->hwndParent; - i = SendMessageW(GetParent (hwnd), WM_NOTIFYFORMAT, (WPARAM)hwnd, NF_QUERY); + i = SendMessageW(infoPtr->hwndNotify, WM_NOTIFYFORMAT, (WPARAM)hwnd, NF_QUERY); if ((i != NFR_ANSI) && (i != NFR_UNICODE)) { WARN("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n", i); i = NFR_ANSI; @@ -1079,7 +1079,7 @@ INT cursel, n, oldItem; NMCBEENDEDITW cbeend; DWORD oldflags; - HWND parent = GetParent (infoPtr->hwndSelf); + HWND parent = infoPtr->hwndNotify; TRACE("for command %d\n", command); @@ -1587,7 +1587,7 @@ static LRESULT COMBOEX_NotifyFormat (COMBOEX_INFO *infoPtr, LPARAM lParam) { if (lParam == NF_REQUERY) { - INT i = SendMessageW(GetParent (infoPtr->hwndSelf), + INT i = SendMessageW(infoPtr->hwndNotify, WM_NOTIFYFORMAT, (WPARAM)infoPtr->hwndSelf, NF_QUERY); infoPtr->NtfUnicode = (i == NFR_UNICODE) ? 1 : 0; } @@ -2070,7 +2070,7 @@ /* strings not equal -- indicate edit has changed */ infoPtr->flags |= WCBE_EDITCHG; } - SendMessageW ( GetParent(infoPtr->hwndSelf), WM_COMMAND, + SendMessageW ( infoPtr->hwndNotify, WM_COMMAND, MAKEWPARAM(GetDlgCtrlID (infoPtr->hwndSelf), CBN_EDITCHANGE), (LPARAM)infoPtr->hwndSelf); @@ -2236,9 +2236,9 @@ case WM_NOTIFY: if (infoPtr->NtfUnicode) - return SendMessageW (GetParent (hwnd), uMsg, wParam, lParam); + return SendMessageW (infoPtr->hwndNotify, uMsg, wParam, lParam); else - return SendMessageA (GetParent (hwnd), uMsg, wParam, lParam); + return SendMessageA (infoPtr->hwndNotify, uMsg, wParam, lParam); /* Window messages we need to process */
diff --git a/dlls/comctl32/datetime.c b/dlls/comctl32/datetime.c index 81a4011..9741560 100644 --- a/dlls/comctl32/datetime.c +++ b/dlls/comctl32/datetime.c
@@ -44,6 +44,7 @@ typedef struct { HWND hMonthCal; + HWND hwndNotify; HWND hUpdown; SYSTEMTIME date; BOOL dateValid; @@ -895,11 +896,8 @@ else ShowWindow(infoPtr->hMonthCal, SW_SHOW); - TRACE ("dt:%p mc:%p mc parent:%p, desktop:%p, mcpp:%p\n", - hwnd,infoPtr->hMonthCal, - GetParent (infoPtr->hMonthCal), - GetDesktopWindow (), - GetParent (GetParent (infoPtr->hMonthCal))); + TRACE ("dt:%p mc:%p mc parent:%p, desktop:%p\n", + hwnd, infoPtr->hMonthCal, infoPtr->hwndNotify, GetDesktopWindow ()); DATETIME_SendSimpleNotify (hwnd, DTN_DROPDOWN); } @@ -1119,7 +1117,7 @@ dtdtc.dwFlags = GDT_VALID; MONTHCAL_CopyTime (&infoPtr->date, &dtdtc.st); - return (BOOL) SendMessageA (GetParent (hwnd), WM_NOTIFY, + return (BOOL) SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, (WPARAM)dtdtc.nmhdr.idFrom, (LPARAM)&dtdtc); } @@ -1127,6 +1125,7 @@ static BOOL DATETIME_SendSimpleNotify (HWND hwnd, UINT code) { + DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd); NMHDR nmhdr; TRACE("%x\n",code); @@ -1134,7 +1133,7 @@ nmhdr.idFrom = GetWindowLongA( hwnd, GWL_ID); nmhdr.code = code; - return (BOOL) SendMessageA (GetParent (hwnd), WM_NOTIFY, + return (BOOL) SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, (WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr); } @@ -1225,6 +1224,7 @@ infoPtr->fieldRect = (RECT *) Alloc (32*sizeof(RECT)); infoPtr->buflen = (int *) Alloc (32*sizeof(int)); infoPtr->nrFieldsAllocated = 32; + infoPtr->hwndNotify = ((LPCREATESTRUCTA)lParam)->hwndParent; DATETIME_SetFormat (hwnd, 0, 0); @@ -1232,7 +1232,7 @@ infoPtr->hMonthCal = CreateWindowExA (0,"SysMonthCal32", 0, WS_BORDER | WS_POPUP | WS_CLIPSIBLINGS, 0, 0, 0, 0, - GetParent(hwnd), + infoPtr->hwndNotify, 0, 0, 0); /* initialize info structure */
diff --git a/dlls/comctl32/header.c b/dlls/comctl32/header.c index 08b1f78..7c1e8a6 100644 --- a/dlls/comctl32/header.c +++ b/dlls/comctl32/header.c
@@ -199,7 +199,7 @@ dis.rcItem = r; dis.itemData = phdi->lParam; oldBkMode = SetBkMode(hdc, TRANSPARENT); - SendMessageA (GetParent (hwnd), WM_DRAWITEM, + SendMessageA (infoPtr->hwndNotify, WM_DRAWITEM, (WPARAM)dis.CtlID, (LPARAM)&dis); if (oldBkMode != TRANSPARENT) SetBkMode(hdc, oldBkMode); @@ -1287,7 +1287,7 @@ infoPtr = (HEADER_INFO *)Alloc (sizeof(HEADER_INFO)); SetWindowLongA (hwnd, 0, (DWORD)infoPtr); - infoPtr->hwndNotify = GetParent(hwnd); + infoPtr->hwndNotify = ((LPCREATESTRUCTA)lParam)->hwndParent; infoPtr->uNumItem = 0; infoPtr->hFont = 0; infoPtr->items = 0;
diff --git a/dlls/comctl32/hotkey.c b/dlls/comctl32/hotkey.c index db27bac..1a6b1c7 100644 --- a/dlls/comctl32/hotkey.c +++ b/dlls/comctl32/hotkey.c
@@ -38,6 +38,7 @@ typedef struct tagHOTKEY_INFO { HWND hwndSelf; + HWND hwndNotify; HFONT hFont; BOOL bFocus; INT nHeight; @@ -222,6 +223,7 @@ infoPtr->HotKey = infoPtr->InvComb = infoPtr->InvMod = infoPtr->CurrMod = 0; infoPtr->CaretPos = 2; infoPtr->hwndSelf = hwnd; + infoPtr->hwndNotify = ((LPCREATESTRUCTA)lParam)->hwndParent; LoadStringW(COMCTL32_hModule, HKY_NONE, infoPtr->strNone, 15); /* get default font height */ @@ -252,7 +254,7 @@ RECT rc; hBrush = - (HBRUSH)SendMessageW (GetParent (infoPtr->hwndSelf), WM_CTLCOLOREDIT, + (HBRUSH)SendMessageW (infoPtr->hwndNotify, WM_CTLCOLOREDIT, wParam, (LPARAM)infoPtr->hwndSelf); if (hBrush) hBrush = (HBRUSH)GetStockObject (WHITE_BRUSH);
diff --git a/dlls/comctl32/ipaddress.c b/dlls/comctl32/ipaddress.c index a607163..dcec3ed 100644 --- a/dlls/comctl32/ipaddress.c +++ b/dlls/comctl32/ipaddress.c
@@ -61,6 +61,7 @@ typedef struct { HWND Self; + HWND Notify; IPPART_INFO Part[4]; } IPADDRESS_INFO; @@ -82,7 +83,7 @@ TRACE("(command=%x)\n", command); - return SendMessageW (GetParent (hwnd), WM_COMMAND, + return SendMessageW (infoPtr->Notify, WM_COMMAND, MAKEWPARAM (GetWindowLongW (hwnd, GWL_ID), command), (LPARAM)hwnd); } @@ -99,7 +100,7 @@ nmip.iField = field; nmip.iValue = value; - SendMessageW (GetParent (infoPtr->Self), WM_NOTIFY, + SendMessageW (infoPtr->Notify, WM_NOTIFY, (WPARAM)nmip.hdr.idFrom, (LPARAM)&nmip); TRACE("<-- %d\n", nmip.iValue); @@ -149,7 +150,7 @@ } -static LRESULT IPADDRESS_Create (HWND hwnd) +static LRESULT IPADDRESS_Create (HWND hwnd, LPCREATESTRUCTA lpCreate) { IPADDRESS_INFO *infoPtr; RECT rcClient, edit; @@ -173,6 +174,7 @@ edit.bottom = rcClient.bottom - 2; infoPtr->Self = hwnd; + infoPtr->Notify = lpCreate->hwndParent; for (i = 0; i < 4; i++) { IPPART_INFO* part = &infoPtr->Part[i]; @@ -508,7 +510,7 @@ switch (uMsg) { case WM_CREATE: - return IPADDRESS_Create (hwnd); + return IPADDRESS_Create (hwnd, (LPCREATESTRUCTA)lParam); case WM_DESTROY: return IPADDRESS_Destroy (infoPtr);
diff --git a/dlls/comctl32/monthcal.c b/dlls/comctl32/monthcal.c index aa6d6cf..5514da2 100644 --- a/dlls/comctl32/monthcal.c +++ b/dlls/comctl32/monthcal.c
@@ -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 */ @@ -1881,6 +1882,8 @@ return 0; } + infoPtr->hwndNotify = ((LPCREATESTRUCTW)lParam)->hwndParent; + infoPtr->hFont = GetStockObject(DEFAULT_GUI_FONT); GetObjectA(infoPtr->hFont, sizeof(LOGFONTA), &logFont); logFont.lfWeight = FW_BOLD;
diff --git a/dlls/comctl32/pager.c b/dlls/comctl32/pager.c index 362f42c..535d708 100644 --- a/dlls/comctl32/pager.c +++ b/dlls/comctl32/pager.c
@@ -44,6 +44,7 @@ typedef struct { HWND hwndChild; /* handle of the contained wnd */ + HWND hwndNotify; /* handle of the parent wnd */ BOOL bNoResize; /* set when created with CCS_NORESIZE */ COLORREF clrBk; /* background color */ INT nBorder; /* border size for the control */ @@ -325,6 +326,7 @@ static void PAGER_CalcSize (HWND hwnd, INT* size, BOOL getWidth) { + PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); NMPGCALCSIZE nmpgcs; ZeroMemory (&nmpgcs, sizeof (NMPGCALCSIZE)); nmpgcs.hdr.hwndFrom = hwnd; @@ -333,7 +335,7 @@ nmpgcs.dwFlag = getWidth ? PGF_CALCWIDTH : PGF_CALCHEIGHT; nmpgcs.iWidth = getWidth ? *size : 0; nmpgcs.iHeight = getWidth ? 0 : *size; - SendMessageA (GetParent (hwnd), WM_NOTIFY, + SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, (WPARAM)nmpgcs.hdr.idFrom, (LPARAM)&nmpgcs); *size = getWidth ? nmpgcs.iWidth : nmpgcs.iHeight; @@ -795,7 +797,7 @@ } nmpgScroll.iScroll -= 2*infoPtr->nButtonSize; - SendMessageA (GetParent(hwnd), WM_NOTIFY, + SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, (WPARAM)nmpgScroll.hdr.idFrom, (LPARAM)&nmpgScroll); TRACE("[%p] PGN_SCROLL returns iScroll=%d\n", hwnd, nmpgScroll.iScroll); @@ -843,6 +845,7 @@ /* set default settings */ infoPtr->hwndChild = NULL; + infoPtr->hwndNotify = ((LPCREATESTRUCTW)lParam)->hwndParent; infoPtr->bNoResize = dwStyle & CCS_NORESIZE; infoPtr->clrBk = GetSysColor(COLOR_BTNFACE); infoPtr->nBorder = 0; @@ -1177,7 +1180,7 @@ nmhdr.hwndFrom = hwnd; nmhdr.idFrom = GetWindowLongA (hwnd, GWL_ID); nmhdr.code = NM_RELEASEDCAPTURE; - SendMessageA (GetParent(hwnd), WM_NOTIFY, + SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, (WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr); } @@ -1267,7 +1270,7 @@ nmhdr.hwndFrom = hwnd; nmhdr.idFrom = GetWindowLongA (hwnd, GWL_ID); nmhdr.code = NM_RELEASEDCAPTURE; - SendMessageA (GetParent(hwnd), WM_NOTIFY, + SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, (WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr); } } @@ -1575,7 +1578,7 @@ case WM_NOTIFY: case WM_COMMAND: - return SendMessageA (GetParent (hwnd), uMsg, wParam, lParam); + return SendMessageA (infoPtr->hwndNotify, uMsg, wParam, lParam); default: return DefWindowProcA (hwnd, uMsg, wParam, lParam);
diff --git a/dlls/comctl32/status.c b/dlls/comctl32/status.c index ee286e0..636021a 100644 --- a/dlls/comctl32/status.c +++ b/dlls/comctl32/status.c
@@ -67,6 +67,7 @@ typedef struct { HWND Self; + HWND Notify; WORD numParts; UINT height; BOOL simple; @@ -170,8 +171,7 @@ dis.hDC = hdc; dis.rcItem = r; dis.itemData = (INT)part->text; - SendMessageW (GetParent (infoPtr->Self), WM_DRAWITEM, - (WPARAM)dis.CtlID, (LPARAM)&dis); + SendMessageW (infoPtr->Notify, WM_DRAWITEM, (WPARAM)dis.CtlID, (LPARAM)&dis); } else { @@ -561,7 +561,7 @@ INT width, x, y; RECT parent_rect; - GetClientRect (GetParent (infoPtr->Self), &parent_rect); + GetClientRect (infoPtr->Notify, &parent_rect); infoPtr->height = height + VERT_BORDER; width = parent_rect.right - parent_rect.left; x = parent_rect.left; @@ -779,7 +779,7 @@ nmhdr.hwndFrom = infoPtr->Self; nmhdr.idFrom = GetWindowLongW (infoPtr->Self, GWL_ID); nmhdr.code = SBN_SIMPLEMODECHANGE; - SendMessageW (GetParent (infoPtr->Self), WM_NOTIFY, 0, (LPARAM)&nmhdr); + SendMessageW (infoPtr->Notify, WM_NOTIFY, 0, (LPARAM)&nmhdr); InvalidateRect(infoPtr->Self, NULL, FALSE); return TRUE; } @@ -829,13 +829,14 @@ SetWindowLongW (hwnd, 0, (DWORD)infoPtr); infoPtr->Self = hwnd; + infoPtr->Notify = lpCreate->hwndParent; infoPtr->numParts = 1; infoPtr->parts = 0; infoPtr->simple = FALSE; infoPtr->clrBk = CLR_DEFAULT; infoPtr->hFont = 0; - i = SendMessageW(GetParent (hwnd), WM_NOTIFYFORMAT, (WPARAM)hwnd, NF_QUERY); + i = SendMessageW(infoPtr->Notify, WM_NOTIFYFORMAT, (WPARAM)hwnd, NF_QUERY); infoPtr->NtfUnicode = (i == NFR_UNICODE); GetClientRect (hwnd, &rect); @@ -923,7 +924,7 @@ } if (!(dwStyle & CCS_NORESIZE)) { /* don't resize wnd if it doesn't want it ! */ - GetClientRect (GetParent (hwnd), &rect); + GetClientRect (infoPtr->Notify, &rect); width = rect.right - rect.left; infoPtr->height = textHeight + 4 + VERT_BORDER; SetWindowPos(hwnd, 0, lpCreate->x, lpCreate->y - 1, @@ -1074,7 +1075,7 @@ if (GetWindowLongW(infoPtr->Self, GWL_STYLE) & CCS_NORESIZE) return FALSE; /* width and height don't apply */ - GetClientRect (GetParent(infoPtr->Self), &parent_rect); + GetClientRect (infoPtr->Notify, &parent_rect); width = parent_rect.right - parent_rect.left; x = parent_rect.left; y = parent_rect.bottom - infoPtr->height; @@ -1100,13 +1101,14 @@ static LRESULT STATUSBAR_SendNotify (HWND hwnd, UINT code) { + STATUSWINDOWINFO *infoPtr = STATUSBAR_GetInfoPtr(hwnd); NMHDR nmhdr; TRACE("code %04x\n", code); nmhdr.hwndFrom = hwnd; nmhdr.idFrom = GetWindowLongW (hwnd, GWL_ID); nmhdr.code = code; - SendMessageW (GetParent (hwnd), WM_NOTIFY, 0, (LPARAM)&nmhdr); + SendMessageW (infoPtr->Notify, WM_NOTIFY, 0, (LPARAM)&nmhdr); return 0; } @@ -1220,7 +1222,7 @@ case WM_NCLBUTTONUP: case WM_NCLBUTTONDOWN: - PostMessageW (GetParent (hwnd), msg, wParam, lParam); + PostMessageW (infoPtr->Notify, msg, wParam, lParam); return 0; case WM_NOTIFYFORMAT:
diff --git a/dlls/comctl32/tab.c b/dlls/comctl32/tab.c index eacef5f..ea74104 100644 --- a/dlls/comctl32/tab.c +++ b/dlls/comctl32/tab.c
@@ -59,6 +59,7 @@ typedef struct { + HWND hwndNotify; /* notification window (parent) */ UINT uNumItem; /* number of tab items */ UINT uNumRows; /* number of tab rows */ INT tabHeight; /* height of the tab row */ @@ -118,13 +119,14 @@ static BOOL TAB_SendSimpleNotify (HWND hwnd, UINT code) { + TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd); NMHDR nmhdr; nmhdr.hwndFrom = hwnd; nmhdr.idFrom = GetWindowLongA(hwnd, GWL_ID); nmhdr.code = code; - return (BOOL) SendMessageA (GetParent (hwnd), WM_NOTIFY, + return (BOOL) SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, (WPARAM) nmhdr.idFrom, (LPARAM) &nmhdr); } @@ -1526,7 +1528,7 @@ /* * send the draw message */ - SendMessageA( GetParent(hwnd), WM_DRAWITEM, (WPARAM)id, (LPARAM)&dis ); + SendMessageA( infoPtr->hwndNotify, WM_DRAWITEM, (WPARAM)id, (LPARAM)&dis ); } else { @@ -3001,6 +3003,7 @@ SetWindowLongA(hwnd, 0, (DWORD)infoPtr); + infoPtr->hwndNotify = ((LPCREATESTRUCTW)lParam)->hwndParent; infoPtr->uNumItem = 0; infoPtr->uNumRows = 0; infoPtr->uHItemPadding = 6; @@ -3044,7 +3047,7 @@ nmttc.hdr.code = NM_TOOLTIPSCREATED; nmttc.hwndToolTips = infoPtr->hwndToolTip; - SendMessageA (GetParent (hwnd), WM_NOTIFY, + SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, (WPARAM)GetWindowLongA(hwnd, GWL_ID), (LPARAM)&nmttc); } } @@ -3113,6 +3116,7 @@ static LRESULT WINAPI TAB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { + TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd); TRACE("hwnd=%p msg=%x wParam=%x lParam=%lx\n", hwnd, uMsg, wParam, lParam); if (!TAB_GetInfoPtr(hwnd) && (uMsg != WM_CREATE)) @@ -3243,7 +3247,7 @@ return TAB_LButtonUp (hwnd, wParam, lParam); case WM_NOTIFY: - return SendMessageA(GetParent(hwnd), WM_NOTIFY, wParam, lParam); + return SendMessageA(infoPtr->hwndNotify, WM_NOTIFY, wParam, lParam); case WM_RBUTTONDOWN: return TAB_RButtonDown (hwnd, wParam, lParam);
diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c index f158f39..e8ec1f8 100644 --- a/dlls/comctl32/toolbar.c +++ b/dlls/comctl32/toolbar.c
@@ -4715,7 +4715,7 @@ infoPtr->nButtonDown = -1; infoPtr->nOldHit = -1; infoPtr->nHotItem = -2; /* It has to be initially different from nOldHit */ - infoPtr->hwndNotify = GetParent (hwnd); + infoPtr->hwndNotify = ((LPCREATESTRUCTW)lParam)->hwndParent; infoPtr->bTransparent = (dwStyle & TBSTYLE_TRANSPARENT); infoPtr->bBtnTranspnt = (dwStyle & (TBSTYLE_FLAT | TBSTYLE_LIST)); infoPtr->dwDTFlags = (dwStyle & TBSTYLE_LIST) ? DT_LEFT | DT_VCENTER | DT_SINGLELINE : DT_CENTER; @@ -5453,7 +5453,7 @@ INT i; if (lParam == NF_REQUERY) { - i = SendMessageA(GetParent(infoPtr->hwndSelf), + i = SendMessageA(infoPtr->hwndNotify, WM_NOTIFYFORMAT, (WPARAM)infoPtr->hwndSelf, NF_QUERY); if ((i < NFR_ANSI) || (i > NFR_UNICODE)) { ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n", @@ -5649,6 +5649,8 @@ static LRESULT WINAPI ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { + TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); + TRACE("hwnd=%p msg=%x wparam=%x lparam=%lx\n", hwnd, uMsg, /* SPY_GetMsgName(uMsg), */ wParam, lParam); @@ -6002,13 +6004,7 @@ case WM_DRAWITEM: case WM_MEASUREITEM: case WM_VKEYTOITEM: - { - TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); - if(infoPtr != NULL) - return SendMessageA (infoPtr->hwndNotify, uMsg, wParam, lParam); - else - return SendMessageA (GetParent (hwnd), uMsg, wParam, lParam); - } + return SendMessageA (infoPtr->hwndNotify, uMsg, wParam, lParam); /* We see this in Outlook Express 5.x and just does DefWindowProc */ case PGM_FORWARDMOUSE:
diff --git a/dlls/comctl32/tooltips.c b/dlls/comctl32/tooltips.c index 644cdb3..0a7e146 100644 --- a/dlls/comctl32/tooltips.c +++ b/dlls/comctl32/tooltips.c
@@ -1902,12 +1902,11 @@ static LRESULT -TOOLTIPS_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) +TOOLTIPS_Create (HWND hwnd, const CREATESTRUCTW *lpcs) { TOOLTIPS_INFO *infoPtr; NONCLIENTMETRICSA nclm; INT nResult; - HWND hParent; /* allocate memory for info structure */ infoPtr = (TOOLTIPS_INFO *)Alloc (sizeof(TOOLTIPS_INFO)); @@ -1930,21 +1929,16 @@ TOOLTIPS_SetDelayTime(hwnd, TTDT_AUTOMATIC, 0L); - hParent = GetParent(hwnd); - if (hParent) { - nResult = (INT) SendMessageA (hParent, WM_NOTIFYFORMAT, + nResult = (INT) SendMessageA (lpcs->hwndParent, WM_NOTIFYFORMAT, (WPARAM)hwnd, (LPARAM)NF_QUERY); - if (nResult == NFR_ANSI) { - infoPtr->bNotifyUnicode = FALSE; + if (nResult == NFR_ANSI) { + infoPtr->bNotifyUnicode = FALSE; TRACE(" -- WM_NOTIFYFORMAT returns: NFR_ANSI\n"); - } - else if (nResult == NFR_UNICODE) { - infoPtr->bNotifyUnicode = TRUE; - TRACE(" -- WM_NOTIFYFORMAT returns: NFR_UNICODE\n"); - } - else { - ERR (" -- WM_NOTIFYFORMAT returns: error!\n"); - } + } else if (nResult == NFR_UNICODE) { + infoPtr->bNotifyUnicode = TRUE; + TRACE(" -- WM_NOTIFYFORMAT returns: NFR_UNICODE\n"); + } else { + TRACE (" -- WM_NOTIFYFORMAT returns: error!\n"); } SetWindowPos (hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOZORDER | SWP_HIDEWINDOW | SWP_NOACTIVATE); @@ -2371,7 +2365,7 @@ case WM_CREATE: - return TOOLTIPS_Create (hwnd, wParam, lParam); + return TOOLTIPS_Create (hwnd, (LPCREATESTRUCTW)lParam); case WM_DESTROY: return TOOLTIPS_Destroy (hwnd, wParam, lParam);
diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c index f93ab93..2a025eb 100644 --- a/dlls/comctl32/treeview.c +++ b/dlls/comctl32/treeview.c
@@ -4718,7 +4718,7 @@ /* Create/Destroy *******************************************************/ static LRESULT -TREEVIEW_Create(HWND hwnd) +TREEVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs) { RECT rcClient; TREEVIEW_INFO *infoPtr; @@ -4797,7 +4797,7 @@ infoPtr->root->iLevel = -1; infoPtr->root->visibleOrder = -1; - infoPtr->hwndNotify = GetParent(hwnd); + infoPtr->hwndNotify = lpcs->hwndParent; #if 0 infoPtr->bTransparent = ( GetWindowLongA( hwnd, GWL_STYLE) & TBSTYLE_FLAT); #endif @@ -5179,7 +5179,7 @@ else { if (uMsg == WM_CREATE) - TREEVIEW_Create(hwnd); + TREEVIEW_Create(hwnd, (LPCREATESTRUCTW)lParam); else goto def; }
diff --git a/dlls/comctl32/updown.c b/dlls/comctl32/updown.c index ba6e04c..8f7dba8 100644 --- a/dlls/comctl32/updown.c +++ b/dlls/comctl32/updown.c
@@ -48,6 +48,7 @@ typedef struct { HWND Self; /* Handle to this up-down control */ + HWND Notify; /* Handle to the parent window */ UINT AccelCount; /* Number of elements in AccelVect */ UDACCEL* AccelVect; /* Vector containing AccelCount elements */ INT AccelIndex; /* Current accel index, -1 if not accel'ing */ @@ -562,8 +563,7 @@ ni.hdr.hwndFrom = infoPtr->Self; ni.hdr.idFrom = GetWindowLongW (infoPtr->Self, GWL_ID); ni.hdr.code = UDN_DELTAPOS; - if (!SendMessageW(GetParent (infoPtr->Self), WM_NOTIFY, - (WPARAM)ni.hdr.idFrom, (LPARAM)&ni)) { + if (!SendMessageW(infoPtr->Notify, WM_NOTIFY, (WPARAM)ni.hdr.idFrom, (LPARAM)&ni)) { /* Parent said: OK to adjust */ /* Now adjust value with (maybe new) delta */ @@ -574,10 +574,8 @@ } /* Also, notify it. This message is sent in any case. */ - SendMessageW( GetParent(infoPtr->Self), - dwStyle & UDS_HORZ ? WM_HSCROLL : WM_VSCROLL, - MAKELONG(SB_THUMBPOSITION, infoPtr->CurVal), - (LPARAM)infoPtr->Self); + SendMessageW( infoPtr->Notify, dwStyle & UDS_HORZ ? WM_HSCROLL : WM_VSCROLL, + MAKELONG(SB_THUMBPOSITION, infoPtr->CurVal), (LPARAM)infoPtr->Self); } /*********************************************************************** @@ -616,7 +614,7 @@ hdr.hwndFrom = infoPtr->Self; hdr.idFrom = GetWindowLongW (infoPtr->Self, GWL_ID); hdr.code = NM_RELEASEDCAPTURE; - SendMessageW(GetParent (infoPtr->Self), WM_NOTIFY, hdr.idFrom, (LPARAM)&hdr); + SendMessageW(infoPtr->Notify, WM_NOTIFY, hdr.idFrom, (LPARAM)&hdr); ReleaseCapture(); } @@ -720,6 +718,7 @@ /* initialize the info struct */ infoPtr->Self = hwnd; + infoPtr->Notify = ((LPCREATESTRUCTA)lParam)->hwndParent; infoPtr->AccelCount = 0; infoPtr->AccelVect = 0; infoPtr->AccelIndex = -1; @@ -798,7 +797,7 @@ if ( (infoPtr->Flags & FLAG_MOUSEIN) && (infoPtr->Flags & FLAG_ARROW) ) { - SendMessageW( GetParent(hwnd), + SendMessageW( infoPtr->Notify, dwStyle & UDS_HORZ ? WM_HSCROLL : WM_VSCROLL, MAKELONG(SB_ENDSCROLL, infoPtr->CurVal), (LPARAM)hwnd);