?
Solved

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

Posted on 2004-09-02
8
Medium Priority
?
1,802 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa‚Ķ
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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 is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses
Course of the Month15 days, 2 hours left to enroll

771 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