Search code examples
c++mfcdynamically-generatedminimizecwnd

MFC - Minimize main MDI window only


I have main MDI window and have custom CWnd derived window which I create dynamically run-time. I want to keep that window on the screen even when main MDI window is minimized but I dont want to have top-most window. I have tried use WS_EX_CONTROLPARENT | WS_EX_APPWINDOW styles, set parent to NULL and set owner to GetDesktopWindow() but nothing works.

Any ideas how I should do that?


Solution

  • When window is minimized, it takes down with it all of its child and owned windows.

    This code creates a regular (not topmost) window which is not hidden when the main frame is minimized:

        HWND hWnd = ::CreateWindow(L"button", L"test", WS_CAPTION|WS_VISIBLE, 
                                   100, 100, 200, 200, GetDesktopWindow(), 0, 0, 0);