Re: CDialog/Invalidate/UpdateWindow question




Scott McPhillips [MVP] wrote:
Benry wrote:
I have a dialog based application with the main dialog calling DoModal
on another dialog. The second dialog is involved in some synchronous
stored procedure calls, and things that take time to complete. I can't
change the processing to threads at this point, but have learned my
lesson.

My question is, when the user clicks on a second application in the
task bar, which is then maximized, or brought to the front in the
z-order on the desktop...when the dialog based app taskbar button is
pressed, nothing happens until it's completed. Is there something I
can do in OnPaint to bring it on the top of the z-order? Am I missing
something? I want all of the application's windows to be displayed
just as if all other windows were minimized.

Thanks,
B3nry


As long as your main thread is blocked (in the synchronous calls) none
of your GUI will work. Including OnPaint and including the task bar
menu. They all live in your main thread, which is blocked.

So the only way to fix this is to make all of the processing a seperate
thread, making the main thread unblocked? OnPaint is being called when
I call UpdateWindow(), but the main window is not brought to the
forefront when I click on the taskbar. Is there an easy fix, since I
wrote around 20k lines of code before realizing that I was doing it
without asynchronous calls to osql, and CDatabase::ExecuteSQL(), as
well as CRecordset::Open().

Thanks again,
benry

.


Quantcast