[Windows API] resize parent, notify childs

Started by
3 comments, last by jhondoe 15 years, 5 months ago
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
Advertisement
oups duplicate
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
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.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

Thx a lot. That's solve my problem: "subclassing"

Then I have read: http://msdn.microsoft.com/en-us/library/ms997565.aspx

++

This topic is closed to new replies.

Advertisement