0

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?

Andrew Komiagin
  • 6,446
  • 1
  • 13
  • 23
IKM2007
  • 716
  • 1
  • 8
  • 31

1 Answers1

1

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);
Vlad Feinstein
  • 10,960
  • 1
  • 12
  • 27
  • Thank you for reply. I am creating window by ::CreateEx function but anyway I passed GetDesktopWindow() for the ParentWindow parameter of ::CreateEx function and seems the only difference is that I am able to interact with the "created" window when main MDI is minimized by the taskbar. But after minimization of main window created window minimized as well even if it had focus previously. So I also need to manually select it from the taskbar to show it. – IKM2007 Nov 24 '15 at 16:00
  • Hmm... I do not observe that behavior. What other styles does your second window have (iIncluding extended styles)? – Vlad Feinstein Nov 24 '15 at 16:05
  • Styles = WS_CAPTION | WS_VISIBLE; ExStyles = WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE | WS_EX_APPWINDOW; – IKM2007 Nov 24 '15 at 17:12
  • Could you please comment on this: `But after minimization of main window created window minimized as well even if it had focus previously`? Even if the second window *HAD* the focus, your minimizing the main frame will sure set focus to that first (when you click on it or its taskbar button). *HOW* exactly you manage to minimize that second window? – Vlad Feinstein Nov 24 '15 at 18:45
  • Sorry for delayed reply. I click on second window and be sure that before the moment when I click the "minimize" button on main window the second window has focus. So after main window minimization it still will be on the top of windows stack. – IKM2007 Nov 29 '15 at 10:40