CClientDc
-
Hi I am using CClientDc in OnTimer(). Sample Code: OnTimer() { CClientDc dc; DisplayAll(dc,xCor,Ycor); Release(&dc); } But When run the program through the Deleaker I am getting GDI leak in this part. I am not sure weather the CClientDc is released. Also my applicatin size increases continously. Pls help to resolve this problem.
-
Hi I am using CClientDc in OnTimer(). Sample Code: OnTimer() { CClientDc dc; DisplayAll(dc,xCor,Ycor); Release(&dc); } But When run the program through the Deleaker I am getting GDI leak in this part. I am not sure weather the CClientDc is released. Also my applicatin size increases continously. Pls help to resolve this problem.
You do not have to call
Release
. The destructor ofCClientDC
will do that when it goes out of scope. The leak is probably because of something that is happening inside theDisplayAll
function.«_Superman_»
I love work. It gives me something to do between weekends. -
Hi I am using CClientDc in OnTimer(). Sample Code: OnTimer() { CClientDc dc; DisplayAll(dc,xCor,Ycor); Release(&dc); } But When run the program through the Deleaker I am getting GDI leak in this part. I am not sure weather the CClientDc is released. Also my applicatin size increases continously. Pls help to resolve this problem.
«_Superman_» is correct: First lose the
Release
and see if commenting outDisplayAll
stops the leaks. If it does one sledgehammer approach is comment bits of the function out bit by bit until you find the problem.Steve
-
Hi I am using CClientDc in OnTimer(). Sample Code: OnTimer() { CClientDc dc; DisplayAll(dc,xCor,Ycor); Release(&dc); } But When run the program through the Deleaker I am getting GDI leak in this part. I am not sure weather the CClientDc is released. Also my applicatin size increases continously. Pls help to resolve this problem.
Get rid of all drawing code in your OnTimer. Make sure OnPaint does all the drawing correctly and then replace all the code in OnTimer with: Invalidate(); That'll help sort out whether the problem is with the drawing code or whether you're committing another faux pas. In case you're wondering Invalidate tells Windows that the window you've called it on needs repainting and it should send a WM_PAINT to the app when the message queue is otherwise empty. This WM_PAINT causes OnPaint to be called. Cheers, Ash