Hi,
i have a little problem of memory leakages in my executable.
inside the function OnPaint() i send a user message (WM_REMOTETFT) to draw a bitmap upon the background image by means of BitBlt instruction.
here you can see a part of my code...
void CProva::OnPaint()
{
CClientDC dc(this);
PostMessage(WM_REMOTETFT);
}
void CProva::OnTFT(WPARAM wParam, LPARAM lParam)
{
CClientDC dc(this);
CDC dcTFT;
HDC hTFT;
HDC hDC=dc.m_hDC;
dcTFT.CreateCompatibleDC(&dc);
hTFT=dcTFT.m_hDC;
dcTFT.SelectObject(&picture);
CBitmap* pOldBitmap = dcTFT.SelectObject(&picture);
dc.BitBlt(X,Y,bmp.bmWidth, bmp.bmHeight, &dcTFT, 0,0,SRCCOPY);
dcTFT.SelectObject(pOldBitmap);
MSG msg;
while
eekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
if (msg.message == WM_QUIT)
{
:
ostQuitMessage(0);
break;
}
if (!AfxGetApp()->PreTranslateMessage(&msg))
{
::TranslateMessage(&msg);
:
ispatchMessage(&msg);
}
}
if
:IsWindow(m_hWnd))
{
PostMessage(WM_REMOTETFT);
}
::ReleaseDC((HWND)this, hDC);
::ReleaseDC((HWND)this, hTFT);
dcTFT.DeleteDC();
}
every time i change the focus (with alt+tab) from another program to mine and the message WM_PAINT is executed the size of my exe increase of 4K...
actually, i don't know the reason because i release all device context and all the CBitmap objects are initialized only in the constructor class
Anyone could suggest me a solution looking at the code?
thanks in advance
D.
i have a little problem of memory leakages in my executable.
inside the function OnPaint() i send a user message (WM_REMOTETFT) to draw a bitmap upon the background image by means of BitBlt instruction.
here you can see a part of my code...
void CProva::OnPaint()
{
CClientDC dc(this);
PostMessage(WM_REMOTETFT);
}
void CProva::OnTFT(WPARAM wParam, LPARAM lParam)
{
CClientDC dc(this);
CDC dcTFT;
HDC hTFT;
HDC hDC=dc.m_hDC;
dcTFT.CreateCompatibleDC(&dc);
hTFT=dcTFT.m_hDC;
dcTFT.SelectObject(&picture);
CBitmap* pOldBitmap = dcTFT.SelectObject(&picture);
dc.BitBlt(X,Y,bmp.bmWidth, bmp.bmHeight, &dcTFT, 0,0,SRCCOPY);
dcTFT.SelectObject(pOldBitmap);
MSG msg;
while
{
if (msg.message == WM_QUIT)
{
:
break;
}
if (!AfxGetApp()->PreTranslateMessage(&msg))
{
::TranslateMessage(&msg);
:
}
}
if
{
PostMessage(WM_REMOTETFT);
}
::ReleaseDC((HWND)this, hDC);
::ReleaseDC((HWND)this, hTFT);
dcTFT.DeleteDC();
}
every time i change the focus (with alt+tab) from another program to mine and the message WM_PAINT is executed the size of my exe increase of 4K...
actually, i don't know the reason because i release all device context and all the CBitmap objects are initialized only in the constructor class
Anyone could suggest me a solution looking at the code?
thanks in advance
D.