Prev: Unexplained WM_COMMAND messages in modeless dialog
Next: Need help using the new MFC feature pack classes
From: Joseph M. Newcomer on 22 Jan 2009 23:43 In spite of the fact that you can presumably specify a parent window for a modeless dialog, the low-level API ignores whatever window you give it and makes the main application window be the parent of the dialog. I even wrote a simple raw-Win32 app to test this, and it fails in the same way. The parent window is apparently completely ignored. CDialog::Create, CDialog::CreateIndirect, ::CreateDialog, ::CreateDialogIndirect, all have this error. Needless to say, this made my bugs list. joe Joseph M. Newcomer [MVP] email: newcomer(a)flounder.com Web: http://www.flounder.com MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Alexander Grigoriev on 23 Jan 2009 00:09 Where is a repro? Note also that the owner window should be an overlapped (top-level) or popup (owned) window. Child window cannot be an owner. Also, if you supply NULL pParentWnd to those MFC functions, the application main window will be used. When I wanted to create an unowned window, I used dummy CWnd without a window created, as pParentWnd. "Joseph M. Newcomer" <newcomer(a)flounder.com> wrote in message news:ljiin45a8i62svf9r5100caod97evm4erl(a)4ax.com... > In spite of the fact that you can presumably specify a parent window for a > modeless > dialog, the low-level API ignores whatever window you give it and makes > the main > application window be the parent of the dialog. I even wrote a simple > raw-Win32 app to > test this, and it fails in the same way. The parent window is apparently > completely > ignored. > > CDialog::Create, CDialog::CreateIndirect, ::CreateDialog, > ::CreateDialogIndirect, all have > this error. > > Needless to say, this made my bugs list. > joe > Joseph M. Newcomer [MVP] > email: newcomer(a)flounder.com > Web: http://www.flounder.com > MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Alexander Grigoriev on 23 Jan 2009 00:11 Exact wording of SDK: "If hwndParent identifies a child window, the system assigns ownership to the top-level parent window of the child window." "Alexander Grigoriev" <alegr(a)earthlink.net> wrote in message news:%23VOd7iRfJHA.500(a)TK2MSFTNGP06.phx.gbl... > Where is a repro? > > Note also that the owner window should be an overlapped (top-level) or > popup (owned) window. Child window cannot be an owner. > > Also, if you supply NULL pParentWnd to those MFC functions, the > application main window will be used. When I wanted to create an unowned > window, I used dummy CWnd without a window created, as pParentWnd. > > "Joseph M. Newcomer" <newcomer(a)flounder.com> wrote in message > news:ljiin45a8i62svf9r5100caod97evm4erl(a)4ax.com... >> In spite of the fact that you can presumably specify a parent window for >> a modeless >> dialog, the low-level API ignores whatever window you give it and makes >> the main >> application window be the parent of the dialog. I even wrote a simple >> raw-Win32 app to >> test this, and it fails in the same way. The parent window is apparently >> completely >> ignored. >> >> CDialog::Create, CDialog::CreateIndirect, ::CreateDialog, >> ::CreateDialogIndirect, all have >> this error. >> >> Needless to say, this made my bugs list. >> joe >> Joseph M. Newcomer [MVP] >> email: newcomer(a)flounder.com >> Web: http://www.flounder.com >> MVP Tips: http://www.flounder.com/mvp_tips.htm > >
From: Joseph M. Newcomer on 23 Jan 2009 16:41
THe problem is that I want a view to own the dialog; I want each view to own a different dialog, and instead of having the dialogs attached to the mainframe, I want it attached to the appropriate view. Note that the restriction you mention is *not* in the documentation of CreateDialog etc. If it is a limitation, then either the API should fail with a suitable error or it should be documented that it will redirect to the parent of a child window. joe On Thu, 22 Jan 2009 21:09:13 -0800, "Alexander Grigoriev" <alegr(a)earthlink.net> wrote: >Where is a repro? > >Note also that the owner window should be an overlapped (top-level) or popup >(owned) window. Child window cannot be an owner. > >Also, if you supply NULL pParentWnd to those MFC functions, the application >main window will be used. When I wanted to create an unowned window, I used >dummy CWnd without a window created, as pParentWnd. > >"Joseph M. Newcomer" <newcomer(a)flounder.com> wrote in message >news:ljiin45a8i62svf9r5100caod97evm4erl(a)4ax.com... >> In spite of the fact that you can presumably specify a parent window for a >> modeless >> dialog, the low-level API ignores whatever window you give it and makes >> the main >> application window be the parent of the dialog. I even wrote a simple >> raw-Win32 app to >> test this, and it fails in the same way. The parent window is apparently >> completely >> ignored. >> >> CDialog::Create, CDialog::CreateIndirect, ::CreateDialog, >> ::CreateDialogIndirect, all have >> this error. >> >> Needless to say, this made my bugs list. >> joe >> Joseph M. Newcomer [MVP] >> email: newcomer(a)flounder.com >> Web: http://www.flounder.com >> MVP Tips: http://www.flounder.com/mvp_tips.htm > Joseph M. Newcomer [MVP] email: newcomer(a)flounder.com Web: http://www.flounder.com MVP Tips: http://www.flounder.com/mvp_tips.htm |