Solved

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

Posted on 2004-09-02
8
1,722 Views
Last Modified: 2013-11-20
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
Comment
Question by:shootah
  • 4
  • 2
8 Comments
 
LVL 16

Accepted Solution

by:
nonubik earned 500 total points
ID: 11964427
Try ::SetWindowPos( hWnd, HWND_TOP,0,0,0,0,SWP_ASYNCWINDOWPOS | SWP_NOSIZE | SWP_NOMOVE );
or HWND_TOPMMOST
0
 

Author Comment

by:shootah
ID: 11965819
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
 
LVL 16

Expert Comment

by:nonubik
ID: 11970876
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:shootah
ID: 11980687
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
 
LVL 16

Expert Comment

by:nonubik
ID: 11980704
At least admit that "your suggestion was syntactically incorrect" is false.
0
 
LVL 16

Expert Comment

by:nonubik
ID: 11980762
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now