Re: MSProvide::Logon and Modal Dialog
- From: changliw@xxxxxxxxxxxxxxxxxxxx (Charles Wang[MSFT])
- Date: Tue, 06 Feb 2007 14:42:47 GMT
Hi,
I am sorry for delaying this response due to two days sick leave.
From my research, it is reasonable to call Pumpmessage when a modal dialogis called by CDialog::DoModal.
When you call CDialog::DoModal, MFC doesn't call ::DialogBox like it used
to; instead, it calls ::Create-DialogIndirect (after great deliberation),
then simulates the modal behavior by disabling the parent window and going
into its own message loop. This is essentially what ::DialogBox does
anyway. The benefit of doing it this way is that MFC owns the dialog's
message loop, whereas the message loop was formerly hidden inside the
Windows API function ::DialogBox. This lets MFC pump modal dialog messages
through the normal MFC channels (CWinThread::PumpMessage) as it does for
other kinds of windows. In particular, you can override
CWnd::PreTranslateMessage for modal dialogs-for example, to implement
accelerator keys. Earlier releases of MFC allowed you to implement your own
PreTranslateMessage for a modal dialog. However, it was never called
because CDialog::DoModal went directly to ::DialogBox, which doesn't return
control to your program until one of your dialog message handlers calls
EndDialog. Also, with ::DialogBox, it's impossible to do idle processing
the normal MFC way since control disappears into ::DialogBox and doesn't
come back until the dialog is over.
You may refer to:
http://www.microsoft.com/msj/archive/s13ec.aspx
However for your issue why Logon method was called again. I would like to
know how you called the modal dialog, by retrieving the CDialog object from
the passed-in handle or by creating a new CDialog object. For further
research, Could you please post some of the code snippet of the
implementation of your IMSProvider::Logon method?
Look forward to your response.
Sincerely yours,
Charles Wang
Microsoft Online Community Support
.
- Prev by Date: Re: Attachment Problem
- Next by Date: Re: Attachment Problem
- Previous by thread: Re: MSProvide::Logon and Modal Dialog
- Next by thread: Re: MSProvide::Logon and Modal Dialog
- Index(es):
Relevant Pages
|