Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I send a WM_PAINT message to my window or trigger a WM_PAINT?

Status
Not open for further replies.

ddeham

Programmer
Sep 30, 2005
11
How do I send a WM_PAINT message to my window or trigger a WM_PAINT message? I tried
SendMessage (hWnd, WM_PAINT, 0, 0);
but that didn't work. I'm using Microsoft eMbedded Visual C++ 4.0 with a non-MFC Pocket PC application.
 
Try using the Invalidate() function.


-Chris (Consultant / Software Engineer)
 
Make sure that the hWnd is a valid handle to the window you want to paint. If the SendMessage() function returns then check that it returned 0. Otherwise, check GetLastError() to see what the failure was. If you want to return immediately, use PostMessage() instead of SendMessage().


HyperEngineer
If it ain't broke, it probably needs improvement.
 
I figured it out. I used
InvalidateRect(hWnd, NULL, TRUE);
By the way
InvalidateRgn(hWnd, NULL, TRUE);
also worked.

Thanks,

Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top