Re: Multi-thread UI program cause modal dialog showing behind main frame
Posted by: Sheng Jiang[MVP]
Actually you need to set the dialog's parent to the currect window. Either
the frame window or its last active popup window.
Microsoft MVP in VC++
"Carol" wrote in message
> Yes. CFileDialog is. But it does not solve the problem. I have already
> set view window as thread's pMainWnd. Some modal dialogs still go
> behind main frame, like the CFileDialog and dialogs popup from
> activex( assume I put an active in the view which would popup a modal
> Joseph M. Newcomer wrote:
> > Actually CFileDIalog IS derived from CDIalog. Check the documentation!
> > joe
> > On Sun, 07 Oct 2007 03:29:22 -0700, Carol wrote:
> > >Thanks. I have already did it, set the view window as thread's
> > >pMainWnd. But it does not work. And when I said 'Modal dialog' I mean
> > >all modal dialog like the File->Open dialog, it's not derived from
> > >CDialog.
> > >On 10 7 , 12 49 , "Doug Harrison [MVP]" wrote:
> > >> On Sat, 06 Oct 2007 05:08:46 -0700, jeff...@hotmail.com wrote:
> > >> >Hi,
> > >> >I have a MDI program which created the view in a UI thread (I know
> > >> >it's advised not to do so, we have some reason to do it). Actually
> > >> >everything goes fine except one problem, sometimes the modal diaog
> > >> >from the main thread will be put BEHIND the main frame, causing the
> > >> >whole program locked up (because we can not click to cancel the
> > >> >dialog). I heard it's somewhat related to tooltip, but I don't know
> > >> >how to avoid it.
> > >> >Any advice is appreciated.
> > >> No guarantees, but setting the thread's m_pMainWnd to AfxGetMainWnd()
> > >> work. It should allow the CDialog code to determine your main window
> > >> the dialog's parent, as it does when all the UI is in a single
> > >> Alternatively, you could try passing AfxGetMainWnd() to the CDialog
> > >> constructor.
> > >> --
> > >> Doug Harrison
> > >> Visual C++ MVP
> > Joseph M. Newcomer [MVP]
> > email: newco...@flounder.com
> > Web:http://www.flounder.com
> > MVP Tips:http://www.flounder.com/mvp_tips.htm- -
> > - -