Re: How do I get CFormView to move while busy processing.



I should point out that the reason the PeekMessage doesn't work is that it quantizes the
message handling to specific points in your program. So either you have to poll often,
which imposes a serious performance burden, or less often, which means the mouse-drag will
be "choppy" and unpleasant.

A similar problem arises if there is a lot of traffic from a thread to the main GUI
thread; you can fill the queue up with posted messages, which first of all makes the GUI
appear to be non-responsive (only because the mouse messages are behind thousands of
posted messages), or even data-losing (because there actually is an upper bound on the
number of posted messages in the queue). In that case, check out my essay on the use of
I/O Completion Ports and the OnIdle handler to minimize the impact of both of these
problems.
joe

On Tue, 28 Jun 2005 13:20:23 -0400, Joseph M. Newcomer <newcomer@xxxxxxxxxxxx> wrote:

>You have to make sure the message pump is running or the messages to update the screen
>will not be processed. Hence the mouse messages are delayed until the message pump is
>again active. You can't "release" the mouse event in the usual sense.
>
>Now one way to do this is to put a PeekMessage/TranslateMessage/DispatchMessage into
>strategically important places, but this really doesn't give a good solution. The best
>solution is to do all the work in one or more separate threads, which then PostMessage
>back to the main GUI thread to cause things to update. Then the GUI stays "live" for the
>duration of the computation. You may need to disable controls that would try to create
>another set of threads while the first thread or threads are doing their work.
>
>Generally, threading is the better solution, but you must deal with issues such as
>synchronization (ideally you should avoid situations in which synchronization is needed)
>and thread termination. See my essays on threading on my MVP Tips site.
> joe
>
>On Tue, 28 Jun 2005 09:11:08 -0700, aesper <aesper@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>
>>Hi,
>> I have a windows application that has a CFormView as the only window
>>showing the status, the program processes files in a directory, the main form
>>calls a seperate class to process each file (in a loop), after coming back
>>from processing each file, I display the status of the processing in an edit
>>inside the CFormView and call UpdateWindow() to refresh the form. The form
>>refreshes fine but if it is moved using the mouse while it is processing it
>>does not phisycally move on the display untill all the images are done. How
>>do I get it to release the mouse event and process it after each file (just
>>like UpdateWindow) not after all files are done.
>>All mouse events have to wait except when I hit the minimize button, it
>>immediately responds and minimizes, but when I click on the task bar to bring
>>it back up it does not come back untill all files are done.
>>
>>Any help is greatly appreciated.
>
>Joseph M. Newcomer [MVP]
>email: newcomer@xxxxxxxxxxxx
>Web: http://www.flounder.com
>MVP Tips: http://www.flounder.com/mvp_tips.htm

Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.