Click here to Skip to main content
15,888,461 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: urgent help Pin
ramina sen29-May-09 8:33
ramina sen29-May-09 8:33 
GeneralRe: urgent help Pin
Cedric Moonen29-May-09 8:51
Cedric Moonen29-May-09 8:51 
GeneralRe: urgent help Pin
CPallini29-May-09 8:58
mveCPallini29-May-09 8:58 
GeneralRe: urgent help Pin
krmed29-May-09 10:17
krmed29-May-09 10:17 
RantRe: urgent help Pin
Michael Schubert29-May-09 12:43
Michael Schubert29-May-09 12:43 
GeneralRe: urgent help Pin
Jim Crafton29-May-09 8:38
Jim Crafton29-May-09 8:38 
AnswerRe: urgent help Pin
Wes Aday29-May-09 9:22
professionalWes Aday29-May-09 9:22 
QuestionWriting a Smart OnPaint Routine Pin
BobInNJ29-May-09 7:15
BobInNJ29-May-09 7:15 
I am trying to understand how to write an efficient OnPaint routine. That is, I want my routine
to only update the part of the screen that needs to be updated. Therefore I wrote a simple program
that creates a window and displays three lines. Below is the OnPaint routine for that program:

void<br />
CMainWindow::OnPaint()<br />
{<br />
	CPaintDC dc(this);<br />
<br />
	RECT rect1;<br />
	BOOL retValue = GetUpdateRect( &rect1 );<br />
	if ( retValue != 0 ) {<br />
		char *ptr = 0;<br />
		*ptr = 23;<br />
	}<br />
	dc.BitBlt( 0, 0, maxX, maxY, &m_memDC, 0, 0, SRCCOPY );<br />
}


The code works but the routine GetUpdateRect always returns 0. I am wondering if the only way to
get GetUpdateRect to return non-zero is if the program sends (via something like SendMessage)
the WM_PAINT message.

You should also observe that in the current code, if GetUpdateRect does return a non-zero value
then the program crashes. Currently, the program never crashes.

Bob
AnswerRe: Writing a Smart OnPaint Routine Pin
CPallini29-May-09 7:39
mveCPallini29-May-09 7:39 
GeneralRe: Writing a Smart OnPaint Routine Pin
BobInNJ29-May-09 9:30
BobInNJ29-May-09 9:30 
QuestionRe: Writing a Smart OnPaint Routine Pin
David Crow6-Nov-09 17:23
David Crow6-Nov-09 17:23 
AnswerRe: Writing a Smart OnPaint Routine Pin
CPallini7-Nov-09 11:23
mveCPallini7-Nov-09 11:23 
GeneralRe: Writing a Smart OnPaint Routine Pin
Michael Dunn30-May-09 18:44
sitebuilderMichael Dunn30-May-09 18:44 
GeneralRe: Writing a Smart OnPaint Routine Pin
BobInNJ31-May-09 4:13
BobInNJ31-May-09 4:13 
QuestionSetwindowPos problem Pin
extreme00129-May-09 6:09
extreme00129-May-09 6:09 
QuestionVisual C++ 6.0 - can't "File Open" after IE 8 and Vista SP2 Pin
Mark C. Malburg29-May-09 5:19
Mark C. Malburg29-May-09 5:19 
AnswerRe: Visual C++ 6.0 - can't "File Open" after IE 8 and Vista SP2 Pin
BobInNJ29-May-09 6:56
BobInNJ29-May-09 6:56 
Answer[OT] Re: Visual C++ 6.0 - can't "File Open" after IE 8 and Vista SP2 Pin
David Crow29-May-09 7:36
David Crow29-May-09 7:36 
GeneralRe: [OT] Re: Visual C++ 6.0 - can't "File Open" after IE 8 and Vista SP2 Pin
Mark C. Malburg29-May-09 8:13
Mark C. Malburg29-May-09 8:13 
AnswerRe: Visual C++ 6.0 - can't "File Open" after IE 8 and Vista SP2 Pin
Joe Woodbury29-May-09 13:30
professionalJoe Woodbury29-May-09 13:30 
AnswerRe: Visual C++ 6.0 - can't "File Open" after IE 8 and Vista SP2 Pin
bodhi rayo11-Oct-10 7:24
bodhi rayo11-Oct-10 7:24 
GeneralRe: Visual C++ 6.0 - can't "File Open" after IE 8 and Vista SP2 Pin
Mark C. Malburg11-Oct-10 8:09
Mark C. Malburg11-Oct-10 8:09 
QuestionCRichtEditView Vertical Auto Scrolling Pin
susanne129-May-09 4:50
susanne129-May-09 4:50 
QuestionWhy the caret of edit control disappeared when it was associated the class encapsulated with my own dll built with CEdit? Pin
bdwzz29-May-09 4:05
bdwzz29-May-09 4:05 
QuestionC + + by diary Pin
anassamar29-May-09 3:12
anassamar29-May-09 3:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.