View Full Version : WM_PAINT message
12-26-2002, 09:42 PM
i have the following code:
DrawClockFace (hwnd, hdc);
DrawHand (hwnd, hdc, 200, 4, (m_nPrevHour * 30) + (m_nPrevMinute / 2));
DrawHand (hwnd, hdc, 400, 8, m_nPrevMinute * 6);
only the DrawClockFace function will run, but th DrawHand will not be implemented,
01-01-2003, 11:22 AM
Do you get an error on DrawHand()? If so is it a compilation or a runtime error?
01-01-2003, 08:13 PM
i found the answer, but i didn't find the solution :o
the answer is: because this code is written not in the WM_PAINT message, it is written in the WM_TIMER message.
so, what is the alternative of the BeginPaint and EndPaint in the WM_TIMER message? :confused:
01-03-2003, 09:40 PM
i get it :D
i must use GetDC() function instead of BeginPaint function :p
good advice: never draw outside outside your WM_PAINT, it is bad programming and soner or later you'll have to deal with the consequences
Put InvalidateRect(hwnd,NULL,TRUE); in your WM_TIMER
(hwnd is the Handle to your window). This will make sure your window gets repainted.
10-08-2006, 07:30 PM
i used Timer to animate. But all functions in OnDraw(). In function OnTimer i sendmessage(WM_PAINT) but no animate was run???
void CToolBarView::OnTimer(UINT nIDEvent)
void CToolBarView::OnDraw(CDC* pDC)
CToolBarDoc* pDoc = GetDocument();
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.