[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1853
  • Last Modified:

Bring an MFC CDialog window to the front of a "Full Screen" OpenGL window

I have an application that has no window decoration,takes up the entire screen space and displays an OpenGL 3D scene.  When stimulated, this application, via an MFC DLL, opens a dialog based window with an AVI based animation.  My problem is that this window will not come to the front of the OpenGL window.  I've tried the following (by searching on experts-exchange):

SetFocus
SetForegroundWindow
SetForegroundWindow(Hwnd)

ShowWindow helps in making the window disapear and appear (it appears on the task bar) however it does not bring it to the forefront.  I've even tried to code up a quick daemon application that will play the AVI but it behaves the same as the DLL.  The ONLY way I have got it to work is if I re-enable the window decoration of the OpenGL app and stimulate the creation of the dialog, Manually(clicking on it) bring the dialog to the front (it does not repaint, it looks locked up) and then call the ShowWindow(SW_HIDE) and then call ShowWindow(SW_SHOW) again.  This will bring it to the front (I presume that the window never went to the background because the OpenGL app's title bar is colored like an unfocused window during this process).
0
shootah
Asked:
shootah
  • 4
  • 2
1 Solution
 
nonubikCommented:
Try ::SetWindowPos( hWnd, HWND_TOP,0,0,0,0,SWP_ASYNCWINDOWPOS | SWP_NOSIZE | SWP_NOMOVE );
or HWND_TOPMMOST
0
 
shootahAuthor Commented:
nonubik,
  Even though your suggestion was syntactically incorrect, it pointed us in the right direction over at MSDN.  The solution was this:

ShowWindow(SW_SHOW);
SetWindowPos( &wndTopMost ,0 ,0 ,0 ,0 ,SWP_ASYNCWINDOWPOS | SWP_NOSIZE | SWP_NOMOVE );

to hide the window:
ShowWindow(SW_HIDE);
SetWindowPos( &wndBottom ,0 ,0 ,0 ,0 ,SWP_ASYNCWINDOWPOS | SWP_NOSIZE | SWP_NOMOVE );

Not sure if the ShowWindow statements are needed but it works that way didn't have time to change it and "experiment".

Thanks for your help...
0
 
nonubikCommented:
Well my friend, I think you're jumping the conclusion, as it seems you are just a dilettante.
So I could NOT be wrong.

Let's clear this: I was refering to the API function ::SetWindowPos(..) (*notice* the ::) and see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowfunctions/setwindowpos.asp

You were refering to CWnd::SetWindowPos, which is something els, if you kindly agree.

So I suggest to change your position regarding this question (who knows, maybe even the grade..)
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
shootahAuthor Commented:
wow.  I gave you the points and everything.  I think you're taking my comment a little personal.  I recently read some pretty wise advice from a seasoned SW engineer.  Programming should be egoless.  You *my friend* have a VERY large ego.  I'll be sure not to "jump the conclusion".  I like your logic too.  I am jumping to conclusions and a dilettante, therefore, you cannot be wrong.  Moron.  

So you gave me the scope resolution operator and assumed I knew what scope you were referring too (I'm not even going to try to interpret the last sentence as the english is horrid.  "the grade?").  Nevertheless, Your advice didn't help as I REFERED to CDialog (and therefore CWnd).  MSDN gave me the solution.  You just gave me the inkling of an idea to search MSDN.   BUT I GAVE YOU THE POINTS ANYWAY.  So you lose control and let your ego do the talking and you post a response that exposes your immaturity.  Thanks for the help little boy (or one who acts like one).  You helped me with my problem and I am very happy about it.

Pack your ego up and go help some one else ok? mmmkay.
0
 
nonubikCommented:
At least admit that "your suggestion was syntactically incorrect" is false.
0
 
nonubikCommented:
Oh, and my horrid sentence... "the grade"?
A C grade is worst than a not accepted answer.

>BUT I GAVE YOU THE POINTS ANYWAY
I didn't shout for them, just suggesting some answer for your question. I use this sit for fun, not to find someone to piss me off.

>Programming should be egoless.
But it's not. And it shouldn't, otherwise where will be the fun of it? If the machines are (for now) egoless, why programming should be?

0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now