CreateCompatibleDC and Memory leak question
Posted on 2009-05-05
I am investigating a memory leak in my Windows Mobile application (Program just freezes from time to time). I have read that when you no longer need a memory device context (such as CreateCompatibleDC) then call the DeleteDC function to delete it.
I have an OnPaint function as follows:
CBitmap *pOldbmp = bmDC.SelectObject(&bmp);
dc.BitBlt(xPos, yPos, bi.bmWidth, bi.bmHeight, &bmDC, 0, 0, SRCCOPY);
I do not have any DeleteDC function here, where should it go and do you think the above could cause my app to crash due to memory leak over a period of time?