Given a MDI Parent Window Handle, how can I enumerate all the form
windows( handles) that are children of the MDI ? I tried GetWindow but
always returns 0 !

Re: MDI Children by Aslan

Aslan
Sat Feb 26 07:17:34 CST 2005


"Nice Chap" <NiceChap@PlasmaDyne.com>, haber iletisinde þunlarý
yazdý:upPks71GFHA.588@TK2MSFTNGP15.phx.gbl...
> Given a MDI Parent Window Handle, how can I enumerate all the form
> windows( handles) that are children of the MDI ? I tried GetWindow but
> always returns 0 !
>
>

You should have the client window handle. If you have an handle to a MDI
child window, you can call GetParent() to get the handle of the client
window if you don't have it. Then you can call EnumChildWindows using it.

For example the following code closes all the MDI windows upon CloseAll
command:

case ID_WINDOW_CLOSE_ALL:
{
::EnumChildWindows( m_pobjMDIClientWnd->GetHandle(),
(WNDENUMPROC)CloseEnumProc,
(LPARAM)this);
return 0;
}

static BOOL CALLBACK CloseEnumProc(HWND hWnd, LPARAM lParam)
{
::SendMessage(hWnd, WM_CLOSE, 0, 0);
return TRUE;
}