Solved

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

Posted on 2004-09-02
8
1,704 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

744 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

11 Experts available now in Live!

Get 1:1 Help Now