[Windows API] resize parent, notify childs
Hi,
I have 2 window: A and B.
A is parent of B.
In my case, I do not have access to the window message procedure of A.
So in the window message procedure of B, how to know when the parent is resizing ?
(which messages are sent to the childs when a parent is resizing ?)
Thx
If no messages are sent to the childs, I am thinking to use hooks.
Maybe I could use something like:
HHOOK hHook = SetWindowsHookEx (WH_CALLWNDPROCRET, (HOOKPROC) hook_proc, GetModuleHandle (NULL), 0);
LRESULT CALLBACK hook_proc (int nCode, WPARAM wParam, LPARAM lParam)
{
if (nCode == HC_ACTION)
{
PCWPSTRUCT wps = (PCWPSTRUCT) lParam;
if (wps->hwnd == parent_win_id && wps->message == WM_SIZE)
{
g_debug ("the parent was resized\n");
}
}
return CallNextHookEx (hHook, nCode, wParam, lParam);
}
But I am not sure if it's really appropriate.
So?
Thx
Maybe I could use something like:
HHOOK hHook = SetWindowsHookEx (WH_CALLWNDPROCRET, (HOOKPROC) hook_proc, GetModuleHandle (NULL), 0);
LRESULT CALLBACK hook_proc (int nCode, WPARAM wParam, LPARAM lParam)
{
if (nCode == HC_ACTION)
{
PCWPSTRUCT wps = (PCWPSTRUCT) lParam;
if (wps->hwnd == parent_win_id && wps->message == WM_SIZE)
{
g_debug ("the parent was resized\n");
}
}
return CallNextHookEx (hHook, nCode, wParam, lParam);
}
But I am not sure if it's really appropriate.
So?
Thx
It's an unclean world :)
A bit cleaner would probably be to subclass (SetWindowLong, GWL_WNDPROC) the parent and get the WM_SIZE message from there.
A bit cleaner would probably be to subclass (SetWindowLong, GWL_WNDPROC) the parent and get the WM_SIZE message from there.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement