The code posted below is based form CodeSampler screenshot app sample
witch also gives same warning.
When i press key for taking screenshot
<pseudo, after device->Present()>
if(key S pressed)
{
lock key S; // just one at a time
take screenshot;
}
and exit app i got this warning:
Quote:
The thread 'Win32 Thread' (0xd80) has exited with code 0 (0x0).
Direct3D9: (INFO) :MemFini!
Direct3D9: (WARN) :Memory still allocated! Alloc count = 160
Direct3D9: (WARN) :Current Process (pid) = 00000d6c
BOMA.exe has triggered a breakpoint
The program '[3436] BOMA.exe: Native' has exited with code 0 (0x0).
it says that memory is still allocated, but when i exit without taking screenshot
there is no warning so my guess its have to do something in my screenshot class:
#include "CScreenShot.h"
CScreenShot::CScreenShot(LPDIRECT3DDEVICE9 pDevice)
{
D3DDISPLAYMODE DisplayMode;
pDevice->GetDisplayMode(0, &DisplayMode);
pDevice->CreateOffscreenPlainSurface(
DisplayMode.Width, DisplayMode.Height,
D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &m_ScreenShotSurface, NULL);
}
CScreenShot::~CScreenShot()
{
if(m_ScreenShotSurface != NULL)
{
m_ScreenShotSurface->Release();
m_ScreenShotSurface = NULL;
}
}
void CScreenShot::SaveScreenShot(LPDIRECT3DDEVICE9 pDevice)
{
pDevice->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &m_ScreenShotSurface);
D3DXSaveSurfaceToFile(L"screenshot.jpg", D3DXIFF_JPG, m_ScreenShotSurface, NULL, NULL);
}
and in my main app class
app class header
...
<declaration>
CScreenShot* m_ScreenShot;
...
in app class cpp init function
<definition>
...
m_ScreenShot = new CScreenShot(m_pDevice->GetDevice());
...
in app class destructor
...
delete m_ScreenShot;
...
so i was assumed that everything is freeed propertly, but it is not, and
i cant see where i am mistaken. I think i posted all relevant code.
Can someone tell me where i am wrong or show me
what your code for screenshot looks like?