You can get WM_MDINEXT by subclassing the MDI client window. For example --
In CMainFrame class -
public:
static LRESULT CALLBACK MDIClientProc(HWND, UINT, WPARAM, LPARAM, UINT_PTR, DWORD_PTR);
In CMainFrame::OnCreate -
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CMDIFrameWndEx::OnCreate(lpCreateStruct) == -1)
return -1;
SetWindowSubclass(m_hWndMDIClient, MDIClientProc, 42, (DWORD_PTR) this);
//....Rest of code
}
Subclass Proc -
LRESULT CMainFrame::MDIClientProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, UINT_PTR uiSubclass, DWORD_PTR dwRefData)
{
if (msg == WM_MDINEXT)
TRACE(_T("Got WM_MDINEXT\n"));
else if (msg == WM_NCDESTROY)
RemoveWindowSubclass(hwnd, MDIClientProc, uiSubclass);
return DefSubclassProc(hwnd, msg, wParam, lParam);
}