@ -431,6 +431,12 @@ int CaptureImage(HWND hWnd, const wchar_t* filename) {
//Close the handle for the file that was created
CloseHandle(hFile);
// clean up
DeleteObject(hbmScreen);
DeleteObject(hdcMemDC);
ReleaseDC(NULL,hdcScreen);
ReleaseDC(hWnd,hdcWindow);
return 0;
}