Click here to Skip to main content
16,005,206 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionReferencing methods via iterators Pin
mjackson1126-Dec-08 15:45
mjackson1126-Dec-08 15:45 
AnswerRe: Referencing methods via iterators Pin
Cedric Moonen26-Dec-08 22:12
Cedric Moonen26-Dec-08 22:12 
GeneralRe: Referencing methods via iterators Pin
mjackson1127-Dec-08 7:07
mjackson1127-Dec-08 7:07 
QuestionRepaointing the Window Pin
BobInNJ26-Dec-08 12:37
BobInNJ26-Dec-08 12:37 
GeneralRe: Repaointing the Window Pin
Luc Pattyn26-Dec-08 13:20
sitebuilderLuc Pattyn26-Dec-08 13:20 
GeneralRe: Repainting the Window Pin
BobInNJ27-Dec-08 10:31
BobInNJ27-Dec-08 10:31 
GeneralRe: Repainting the Window Pin
Luc Pattyn27-Dec-08 11:30
sitebuilderLuc Pattyn27-Dec-08 11:30 
GeneralRe: Repainting the Window Pin
BobInNJ27-Dec-08 13:49
BobInNJ27-Dec-08 13:49 
Luc, or anybody else that knows, here is what I wrote:
<br />
LRESULT<br />
CMainWin::ReportAEvent(WPARAM wParam, LPARAM lParam)<br />
{<br />
	failCount ++;<br />
	RECT rect1;<br />
	rect1.top = m_X;<br />
	rect1.bottom = m_X + 20;<br />
	rect1.left = 2;<br />
	rect1.right = 20;<br />
	this->InvalidateRect( &rect1 );<br />
	this->UpdateWindow();<br />
	return 0;<br />
}<br />


Now, my OnPaint rountine looks like the following:
<br />
// Update screen using contexts of virtual window.<br />
afx_msg void CMainWin::OnPaint()<br />
{<br />
	CPaintDC DC(this);<br />
<br />
	RECT rec1;<br />
	this->GetUpdateRect( &rec1 );<br />
	if ( rec1.top != 0 || rec1.bottom != 0 || rec1.left != 0 || rec1.right != 0 ) {<br />
		int i = 10;<br />
		int j = 20;<br />
		int k = i + j;<br />
	}<br />
        .<br />
        .<br />
        .<br />


Originally, I was calling Invalidate method rather than InvalidateRect and Update. When I was calling Invalidate method, the window was being updated from ReportAEvent via a call to OnPaint. Now, when I have the call to InvalidateRect and Update I am not getting a call to OnPaint from the method ReportAEvent. In addition, as far as I can tell, the body of the if statement is never executed.

This does not make a lot of sense to me. I would expect the call to UpdateWindow to be generating a WM_PAINT request and therefore a call to OnPaint. In addition, I have tried running the program where part of the window is covered by anther window and then the original window is brought to the foreground. In this case, I would expect the body of the if statement to be executed. It is not.

Please tell me what I am missing.

Thanks

Bob
GeneralRe: Repainting the Window Pin
Luc Pattyn27-Dec-08 15:15
sitebuilderLuc Pattyn27-Dec-08 15:15 
GeneralRe: Repainting the Window Pin
BobInNJ28-Dec-08 6:43
BobInNJ28-Dec-08 6:43 
GeneralRe: Repainting the Window Pin
Luc Pattyn28-Dec-08 14:15
sitebuilderLuc Pattyn28-Dec-08 14:15 
GeneralRe: Repainting the Window Pin
BobInNJ29-Dec-08 6:58
BobInNJ29-Dec-08 6:58 
GeneralRe: Repainting the Window Pin
Luc Pattyn29-Dec-08 7:13
sitebuilderLuc Pattyn29-Dec-08 7:13 
GeneralRe: Repainting the Window Pin
BobInNJ29-Dec-08 9:08
BobInNJ29-Dec-08 9:08 
GeneralRe: Repainting the Window Pin
Luc Pattyn29-Dec-08 9:55
sitebuilderLuc Pattyn29-Dec-08 9:55 
GeneralRe: Repainting the Window Pin
BobInNJ29-Dec-08 11:28
BobInNJ29-Dec-08 11:28 
GeneralRe: Repainting the Window Pin
Luc Pattyn29-Dec-08 14:58
sitebuilderLuc Pattyn29-Dec-08 14:58 
GeneralRe: Repainting the Window Pin
BobInNJ30-Dec-08 4:37
BobInNJ30-Dec-08 4:37 
AnswerRe: Repainting the Window [modified] Pin
BobInNJ29-Dec-08 9:03
BobInNJ29-Dec-08 9:03 
Questioncan you help me a recursion project with c++? Pin
silversword8626-Dec-08 8:58
silversword8626-Dec-08 8:58 
GeneralRe: can you help me a recursion project with c++? Pin
Luc Pattyn26-Dec-08 9:20
sitebuilderLuc Pattyn26-Dec-08 9:20 
Questionhtml res files don't seem to work anymore. Pin
Jim Crafton26-Dec-08 4:55
Jim Crafton26-Dec-08 4:55 
AnswerRe: html res files don't seem to work anymore. Pin
Richard Andrew x6426-Dec-08 5:10
professionalRichard Andrew x6426-Dec-08 5:10 
GeneralRe: html res files don't seem to work anymore. Pin
Jim Crafton26-Dec-08 5:13
Jim Crafton26-Dec-08 5:13 
GeneralRe: html res files don't seem to work anymore. Pin
Richard Andrew x6426-Dec-08 5:15
professionalRichard Andrew x6426-Dec-08 5:15 

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.