Search code examples
win32guimdichild

No restore button in maximised window


When I maximise one of my mdi client windows. I am then stuck with it maximised, I need to be able to restore it to view the other windows.

WNDCLASSEX wc;

wc.cbSize        = sizeof(WNDCLASSEX);
wc.style         = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
wc.lpfnWndProc   = CWindowHandler::MsgRouter;
wc.cbClsExtra    = 0;
wc.cbWndExtra    = 0;
wc.hInstance     = hInstance;
wc.hIcon         = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wc.lpszMenuName  = NULL;
wc.lpszClassName = childClassName;
wc.hIconSm       = LoadIcon(NULL, IDI_APPLICATION);

hChild = CreateMDIWindow(childClassName, "Segments", WS_OVERLAPPEDWINDOW, m_winRect.left, m_winRect.top, m_winRect.right - m_winRect.left, m_winRect.bottom - m_winRect.top, CWindowHandler::GetInstance()->GetMDIClient(), m_hInstance, (LPARAM)this);

Solution

  • i fixed this by calling return DefMDIChildProc(m_Hwnd, msg, wParam, lParam); in the case WM_SIZE: of the wndprocs of the child window. god knows why but it worked.