The problem is that at some point the visualization thread stops redrawing.
The strange thing is that my OnTimer method still gets called but the
Invalidate() call does not cause the OnPaint() method to be called. Does
anyone have a clue of why this might happen? Does anyone know how I can
prevent using a timer so that the visualization thread instantaneously
repaints whenever the worker thread has got new data and does not wait until
the timer fires?
Thanks in advance,
Fabian Ottjes
WM_PAINT is the lowest priority message, so it may be that your high
priority thread is simply taking too much time. If it is polling the
port you could (and should) restructure it to use overlapped I/O, which
is efficient - and doesn't miss messages - and can still use a very high
priority - but doesn't waste CPU cycles. The MTTTY sample application
gives an example.
The best approach for updating the visual thread is to post a
user-defined message to it from the I/O thread. There is an example in
http://www.mvps.org/vcfaq/mfc/index.htm
--
Scott McPhillips [VC++ MVP]
Have you tried UpdateWindow() just after the Invalidate(). GUI updating has a low priority
and isn't handled if there are other messages pending. And so are Timer messages.
Instead of using a timer you could post a user message from the serial port thread.
Ruben
I would say skip the timer and use PostMessage; read my essay on worker threads on my MVP
Tips site.
joe
On Thu, 28 Feb 2002 13:27:03 +0100, "Fabian Ottjes" <Fabian...@t-online.de> wrote:
Joseph M. Newcomer [MVP]
email: newc...@flounder.com
Web: http://www3.pgh.net/~newcomer
MVP Tips: http://www3.pgh.net/~newcomer/mvp_tips.htm