Re: My window doesn't re-display itself
You are locking up the message pump, while your loop is running the apps
message does not have a chance to process any messages, like WM_PAINT.
You can either move the file processing code into a worker thread, that way
the UI thread will not block. (the prefered method of solving this problem)
Or you can pump messages during your loop. You would have to call this
method (you can put it in the app or your dialog class) from within your
loop periodically, the more you call this the smoother the UI becomes.
void CMyApp::Yeild()
{
MSG Msg;
while (PeekMessage(&Msg,NULL,0,0,PM_REMOVE))
{
if (!PreTranslateMessage(&Msg))
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
}
}
But like I said the worker thread is your best bet.
AliR.
"Mike Silva" <snarflemike@yahoo.com> wrote in message
news:dd3e938d-f7f6-4310-9d93-c82a3ae6d35a@m3g2000hsc.googlegroups.com...
Hi,
I have written some utilities as MFC dialog apps. They will typically
loop through some list doing things to various files, and listing
their progress in static text windows (info such as current file name,
number of files processed, number of files remaining). The apps do
what they're supposed to and everything is fine, and the status
displays work properly, except...
If, while my utility app is processing files, I select another app,
e.g. check my email or browse the web, and then select the utility app
again, the display does not refresh - all I get is a completely blank
dialog box. The windows and controls inside the dialog box only
refresh when the utility is finished running. If I never navigate
away from the utility app, the display keeps updating as expected and
designed.
So, what do I need to do (perhaps after each file is processed) to
assure that my display is responsive and everything will re-display
when the app window goes from inactive to active? Thanks.
Mike