Can anyone think of a reason how an application that runs fine on an
emulator could receive (what appears to be) an infinite number of
WM_PAINT events when running on an actual device?

At the moment, I'm debugging in EVT3 targeting a PPC'02 device (Dell
Axim x5), but I suspect the same behavior on WM5 emulator vs. device.
It's an MFC application written in C++. All dialogs are rock solid
except one that includes an OnPaint handler to draw a plot region.

Any suggestions for things I could investigate?

Thanks, Mike
http://pnmx.com/

Re: Emulator okay, but device gets nonstop WM_PAINT events by r_z_aret

r_z_aret
Sat May 12 15:00:56 CDT 2007

On 11 May 2007 12:14:31 -0700, Mike <mlandis001@comcast.net> wrote:

>Can anyone think of a reason how an application that runs fine on an
>emulator could receive (what appears to be) an infinite number of
>WM_PAINT events when running on an actual device?

My best guess is that something in your WM_PAINT handler is triggering
a repaint. Showing us that code might help.

Until you know otherwise, I recommend assuming the bug is in your
code, and the fact it shows only on real devices (or the other way
around) is an artifact. Many of my bugs that showed on one platform
but not another were bugs in my code that should have showed on all
platforms. Only a few were caused by bugs in one of the platforms.
Some were caused by differences that I hadn't counted on (some
platforms are more prone to refreshing screens).

>
>At the moment, I'm debugging in EVT3 targeting a PPC'02 device (Dell
>Axim x5), but I suspect the same behavior on WM5 emulator vs. device.

The emulators that came with the SDKs for eVT 3 and eVT 4 are
notoriously unreliable as predictors for how well code would run on
real devices. The emulator that comes with VS 2005 seems to be a much
closer approximation to real hardware.


>It's an MFC application written in C++. All dialogs are rock solid
>except one that includes an OnPaint handler to draw a plot region.
>
>Any suggestions for things I could investigate?

Have you tried stepping through the code in your WM_PAINT handler to
see whether something triggers a WM_PAINT message?

>
>Thanks, Mike
>http://pnmx.com/

-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).

Robert E. Zaret, eMVP
PenFact, Inc.
20 Park Plaza, Suite 478
Boston, MA 02116
www.penfact.com

Re: Emulator okay, but device gets nonstop WM_PAINT events by Paratracker

Paratracker
Sun May 13 13:04:00 CDT 2007

Robert,

Thanks for responding. The OnPaint code is quite lengthy (it plots a grid,
labels, and four functions). Each polyline involves database lookups and a
series of present value calculations, so the code goes way deeper than
CreatePen, ExtTextOut, SelectObject, MoveTo, LineTo, Polyline, ... I have
another application with similar (but not identical) plotting code and it
doesn't generate extra WM_PAINT events (WinDiff wouldn't pick up on the
commonalities, so looking at line-by-line differences wouldn't get you
anywhere).

I have noticed that calling GetUpdateRgn always returns an ERROR. I am not
invalidating any RECTs or regions within OnPaint or the functions it calls.
What else can I look for?

-Mike
http://pnmx.com

Re: Emulator okay, but device gets nonstop WM_PAINT events by Paratracker

Paratracker
Mon May 14 10:44:00 CDT 2007

Robert,

This issue has been resolved - I had a CWaitCursor in OnPaint, .e.g.

OnPaint()
{ CWaitCursor wait;
...
}

which causes an infinite supply of WM_PAINT messages. I didn't debug into
the CWaitCursor destructor, but I assume that it invalidates the region
beneath the cursor before going away.

Thanks for your help...

-Mike
http://pnmx.com