Re: MSProvide::Logon and Modal Dialog

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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 dialog
is 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

.



Relevant Pages

  • how to measurewaveIn staggering
    ... detect cases when the main message loop does not idle for a long time. ... System function DialogBox creates its own message loop and my ... Windows CE they are not officially supported. ...
    (microsoft.public.pocketpc.developer)
  • Re: MFC Dialog-based app crashes
    ... I mean every MFC application(of cource a windows application) should have ... its own main message loop to process the message, ...
    (microsoft.public.vc.mfc)
  • Re: Help with text adventure
    ... You can also just write a console app with printf and getline, ... Is there a way to make a Win32 console application? ... Since you don't want or need MFC, ... windowing process of Windows, like it was behind any Windows program. ...
    (microsoft.public.win32.programmer.gdi)
  • Re: Learning process
    ... If you use wxWindows, the same code can be used for ANY ... I've said is that using wxWindows massively increases your userbase ... wxWindows, it would have a *potential* userbase of Windows, Mac <OSX, OS ... you're massively increasing the userbase which you 100% won't do using MFC. ...
    (alt.comp.lang.learn.c-cpp)
  • Fishy Behavior when using Managed code in Unmanaged environment
    ... We have an MFC application that is compiled under VS 2003 (its a pure ... AND THEN we found this article on MSDN "Windows Forms and Unmanaged ... When you open a Windows Form from a COM client application, ... Is this message pump incompatibility the real reason for our keyboard ...
    (microsoft.public.dotnet.framework.interop)