Search code examples
windowsmfcwindowmdi

Make my MDI application topmost of other applications?


I want to make my MDI MFC application topmost of all other applications' windows running on windows OS. So I can make a screen shot of one view within my application.
But functions like SetWindowPos(&CWnd::wndTopMost, 0, 0, 0, 0, SWP_SHOWWINDOW); or SetFocus() (called in my view class) doesn't work at all.
Whenever another application's window is on the top of mine's and I make a screenshot, it will save a picture of the window on top of mine.

So how to make my application's windows(specifically the view window) on top of other applications' windows?


Solution

  • I want to make my MDI MFC application topmost of all other applications' windows.

    This is simply not possible. If your application could do that, then so could the other applications. Only one could win, and there's no reason why your application could be more special than the others.