Click here to Skip to main content
15,919,358 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Modeless Dialog to Modal Dialog Pin
Michael Dunn18-Jul-07 7:14
sitebuilderMichael Dunn18-Jul-07 7:14 
GeneralRe: Modeless Dialog to Modal Dialog Pin
Mark Salsbery18-Jul-07 7:29
Mark Salsbery18-Jul-07 7:29 
AnswerRe: Modeless Dialog to Modal Dialog Pin
«_Superman_»17-Jul-07 21:03
professional«_Superman_»17-Jul-07 21:03 
QuestionRe: Modeless Dialog to Modal Dialog Pin
David Crow18-Jul-07 2:59
David Crow18-Jul-07 2:59 
QuestionIntercept a message from another application Pin
Cui Sheng17-Jul-07 15:20
Cui Sheng17-Jul-07 15:20 
AnswerRe: Intercept a message from another application Pin
Stephen Hewitt17-Jul-07 16:21
Stephen Hewitt17-Jul-07 16:21 
GeneralRe: Intercept a message from another application Pin
Cui Sheng17-Jul-07 22:00
Cui Sheng17-Jul-07 22:00 
QuestionMFC custom control using 100% CPU [solved] Pin
kalden17-Jul-07 14:13
kalden17-Jul-07 14:13 
Hello,

Well, I have created a custom MFC control that derives from CWnd. I have done some work to add double buffering, but now i have a problem. My application sucks up 100% of the CPU.

I have it narrowed down to one line.

void CGameArea::OnPaint()<br />
{<br />
   //CWnd::OnPaint();   //PROBLEM HERE<br />
   mPlayer->Draw();<br />
<br />
	 //BitBlt the memory HDC to the screen HDC<br />
   CRect r;<br />
   GetClientRect(&r);<br />
<br />
	 CDC *dc = GetDC();<br />
	 dc->BitBlt(r.left,r.top,r.right-r.left,r.bottom-r.top,&mBackgroundDC,0,0,SRCCOPY);<br />
	 ReleaseDC(dc);<br />
}


I am currently not calling the base CWnd OnPaint function because I am doing all the painting myself. Somehow, this is causing the problem.

If I uncomment the base class OnPaint call, my CPU usage goes back to normal, but I get a lot of flicker.

Any idea why NOT calling the CWnd OnPaint would cause 100% CPU usage??



Thanks ahead of time for any help.

-Kevin



-- modified at 8:53 Wednesday 18th July, 2007
AnswerRe: MFC custom control using 100% CPU Pin
Mark Salsbery17-Jul-07 14:24
Mark Salsbery17-Jul-07 14:24 
GeneralRe: MFC custom control using 100% CPU Pin
kalden17-Jul-07 14:34
kalden17-Jul-07 14:34 
AnswerRe: MFC custom control using 100% CPU Pin
Naveen17-Jul-07 14:32
Naveen17-Jul-07 14:32 
GeneralRe: MFC custom control using 100% CPU Pin
kalden17-Jul-07 14:40
kalden17-Jul-07 14:40 
GeneralRe: MFC custom control using 100% CPU Pin
Naveen17-Jul-07 14:45
Naveen17-Jul-07 14:45 
GeneralRe: MFC custom control using 100% CPU Pin
kalden17-Jul-07 14:47
kalden17-Jul-07 14:47 
GeneralRe: MFC custom control using 100% CPU Pin
Naveen17-Jul-07 14:49
Naveen17-Jul-07 14:49 
QuestionHow to Implement a Virtual Grid [modified] Pin
Stuck At Zero17-Jul-07 9:37
Stuck At Zero17-Jul-07 9:37 
AnswerRe: How to Implement a Virtual Grid Pin
led mike17-Jul-07 10:44
led mike17-Jul-07 10:44 
GeneralRe: How to Implement a Virtual Grid Pin
Stuck At Zero17-Jul-07 11:14
Stuck At Zero17-Jul-07 11:14 
GeneralRe: How to Implement a Virtual Grid Pin
led mike17-Jul-07 11:23
led mike17-Jul-07 11:23 
GeneralRe: How to Implement a Virtual Grid Pin
Stuck At Zero17-Jul-07 11:40
Stuck At Zero17-Jul-07 11:40 
QuestionRe: How to Implement a Virtual Grid Pin
Stuck At Zero18-Jul-07 4:12
Stuck At Zero18-Jul-07 4:12 
AnswerRe: How to Implement a Virtual Grid Pin
led mike18-Jul-07 6:29
led mike18-Jul-07 6:29 
GeneralRe: How to Implement a Virtual Grid Pin
Stuck At Zero18-Jul-07 6:48
Stuck At Zero18-Jul-07 6:48 
GeneralRe: How to Implement a Virtual Grid Pin
led mike18-Jul-07 7:14
led mike18-Jul-07 7:14 
GeneralRe: How to Implement a Virtual Grid Pin
Stuck At Zero18-Jul-07 7:36
Stuck At Zero18-Jul-07 7:36 

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.