- Remove
Capture
function
You must call GdiplusStartup before you create any GDI+ objects, and you must delete all of your GDI+ objects (or have them go out of scope) before you call GdiplusShutdown. - MS Docs
Origin here
That is, objects created after the Gdip_Shutdown function is called are not available.
So there is a memory leak.
- Change to Gdip_BitmapFromScreen function from Capture function.(In InactiveImageSearch, InactivePixelSearch, MultipleInactivePixelSearch)
- Change to Gdip_CloneBitmapArea function from Gdip_CropImage function.(In CaptureforSave)
- Add IsWindowMinimize function
- In CaptureforSave function, change Gdip_BitmapFromHWND to Gdip_BitmapFromScreen
- In Capture function, change Gdip_BitmapFromHWND to Gdip_BitmapFromScreen
PrintWindow is slow, and you can avoid that overhead on most windows. just use Gdip_BitmapFromScreen() with "hwnd:" string parameter instead of Gdip_BitmapFromHwnd(), and that will still work for inactive windows as long as the DWM is running. - guest3456(Forum)