Modal Dlg opens in background... which it shoudl't.

TobiDoo's Avatar, Join Date: Jun 2011
Newbie Member
Greetings to the forum!

Recently I got into programming with mfc. For a while now I have been working on a dialog-based application.

Now, whenever I want to open another modal dialog-box, (at the moment there are 2, with wnd.DoModal() ) it opens, but behind the main window. Then, when I press alt-key, it comes to the forground... However, when I draw something in the DC of the initial dialog, the other windows open correctly. Now I have implemented a bitmap to be displayed, and its still the same as before - the other dialog-boxes still wont open in the forground.

Why does this happen and how can I correct it?

I hope, you get a picture of whats going on and you have any ideas. I will certainly post any code you need to see, but alltogether its just too much to post, and I dont know which parts are the important ones for this problem.
I have compared all (which I think) is relevant to a new application, and its so far all identical.

Thanks a lot in advance for your help,
so long,
tobi
rsquareshelke's Avatar, Join Date: Dec 2010
Go4Expert Member
use SetforegroundWindow or BringToDesktop