I am using ShellExecute with verb "open" to show *.txt files and *.pdf files. I have been doing this forever, and was simple and worked fine. Recently I changed some of the architecture of my application ( MFC, C++, VS2015 ) in that certain panels are Modal, others non-Modal, and I have various situations like "a Modal that is a child of a non-Modal" and so forth. Now when I do a ShellExecute, the document is not on top -- its 'under' one or more of the screens of my app. So, I've tried a few things to make it pop on top, like:
HINSTANCE h = ShellExecute(NULL, _T("open"), doc, NULL, NULL, SW_SHOWNORMAL);
HWND hwnd = this->GetSafeHwnd();
HINSTANCE h = ShellExecute(hwnd, _T("open"), doc, NULL, NULL, SW_SHOWNORMAL);
( and in the above, instead of "this" which is the currently-open Modal panel, I tried passing its non-modal parent panel, and other guesses)
I also tried:
HINSTANCE h = ShellExecute(HWND_TOPMOST, _T("open"), doc, NULL, NULL, SW_SHOWNORMAL);
But in all cases, the document opens behind my full-screen panel or its parent, and can't be seen.
Is there some way to make the thing pop up 'top-most' ?