Re: Catch WM_SIZE
Hi,
The parent need to know when this child control change size because it must
be realign on CENTER of the dialog.
I find a working solution :
LRESULT CALLBACK MyControlCtrlNewWndProc(HWND hWnd,UINT Message, WPARAM
wParam, LPARAM lParam);
LONG MyControlOldWndProc;
BOOL CMyDialog::OnInitDialog()
{
CDialog::OnInitDialog();
m_MyControlCreate( NULL, _T(""), WS_VISIBLE, CRect(10, 10, 0, 0), this, 1
);
MyControlOldWndProc = SetWindowLong(m_MyControl, GWL_WNDPROC,
(long)MyControlCtrlNewWndProc);
...
}
LRESULT CALLBACK MyControlCtrlNewWndProc(HWND hWnd, UINT Message, WPARAM
wParam, LPARAM lParam)
{
switch(Message)
{
case WM_SIZE :
LRESULT result = CallWindowProc( (WNDPROC)TrappeOldWndProc, hWnd, NULL,
wParam, lParam);
// Do realign stuff...
return result;
break;
}
// Call default function
return CallWindowProc((WNDPROC)MyControlOldWndProc, hWnd, Message, wParam,
lParam);
}
What are you thinking of this solution ?
"Doug Harrison [MVP]" wrote:
On Thu, 14 Aug 2008 08:25:01 -0700, Erakis
<Erakis@discussions.microsoft.com> wrote:
Thank for your anwser but this is not what I need.
I want to intercept this message IN my DIALOG. Not in my derived class.
Only the derived class will see its WM_SIZE messages. You need to handle it
there, either in your derived class, or by dynamically subclassing the
window (not recommended). No matter what, the dialog won't see the message
unless the control forwards it. What are you trying to accomplish?
--
Doug Harrison
Visual C++ MVP