Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2004-09-02
8
Medium Priority
?
1,823 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
8 Comments
 
LVL 16

Accepted Solution

by:
nonubik earned 1500 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
Ready to get certified? Check out some courses that help you prepare for third-party exams.
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.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

609 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