From the OP's description of the dialog, I presumed it to be a modeless status dialog that did not
impede continued processed or force a modal interface.
"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message
Note that since the normal loop processing suggested would be taking place in the main GUI
thread, there would be no message pump to handle the "Cancel" button. I would probably
try to use a separate thread to handle this kind of problem, so I would use an ordinary
modal dialog, override the OnOK and OnCancel handlers to make sure that Enter and Esc
don't close the dialog, and for the Cancel button, use a control ID other than IDCANCEL.
joe
On Fri, 15 May 2009 23:44:15 -0500, "Scot T Brennecke" <ScotB@MVPs.spamhater.org> wrote:
As David advised, use the CDocument-derived class to handle the importing. There should be at
least
one CView-derived class attached to the document, and the document can send the view update
instructions by calling UpdateAllViews.
When the document is created in an MDI app, the child frame window will be created with the
associated view inside it. The view can then launch your status dialog (if a dialog is really
needed -- why not do that feature in the view?). The view would be the parent of the dialog (if
needed). When the "Cancel" button is pressed, the view is informed, and it instructs its document
to abort the processing by calling a function that sets a bool flag member in the document.
During
the document's processing loop, it checks this flag to see if it should continue or not.
"JRGlide" <JRGlide@discussions.microsoft.com> wrote in message
news:EC658DFD-B3EC-4CE6-8D10-3CBB778D3389@microsoft.com...
I probably didn't phrase the third part of the question very well. The
dialog is a status dialog created (and owned) by whoever is doing the
importing, currently the Document class. The reason I need the parent window
is that the dialog contains a "Cancel" button to end processing. But since I
am in a hard loop this button doesn't get processed unless I do a PeekMessage
and PreTranslateMessage which requires that I know the parent.
I think that AfxGetMainWnd() may do the trick, though. Thank you.
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm