On Jul 12, 3:39 pm, "David Ching" <d...@remove-this.dcsoft.com> wrote:
You are right, but maybe something is wrong with your PeekMessage loop. Are
you calling CProgressWnd::PeekAndPump()?
No. Because of my understanding (which I described in the previous
posting) I decided that a PeekMessage loop was NOT needed, so I don't
call ::PeekMessage() nor CProgressWnd::PeekAndPump().
And provided I send FEWER than approx 5 progress messages per sec from
the filter graph to the handler in my main CMyDialog object then
CProgressWnd::OnCancel() gets called and it *seems* to works fine -
but it doesn't fill me with confidence!
To simplify, first start a 0.5 second timer. Then call CProgressWnd::Create
to put up the dialog modelessly. Then start your background thread that
starts the filter graph. When your primary thread receives messages from
the thread, call the CProgressWnd to update the progress. When your
OnTimer() is called every 0.5 seconds, call CProgressWnd::Cancelled() to see
if the Cancel button has been clicked.
Thanks for your suggestion. I just tried using only Create and I can
allow LOTS of progress messages per sec to be sent from filter graph
to the CMyDialog handler, and pressing the Cancel button results in
OnCancel being executed IMMEDIATELY every time!
That's great, except that I NEED the CProgressWnd to be modal - I
don't want anyone messing with the main window while the "progressed"
operation is taking place.
window. Then there is no confusion with different message pumps.