Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > C/C++
You last visited: Today at 20:50

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



GDIPLUS Memory Leak

Discussion on GDIPLUS Memory Leak within the C/C++ forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Feb 2010
Posts: 23
Received Thanks: 4
GDIPLUS Memory Leak

Hello Guys,
i need help with some code of mine. I am using GDIPlus and am trying to create a Get Pixel Function. My Function works fine, but unfortunately i get some weird memory issues. My GDI-Object counter in task manager increases, but I dont know why. Especially since it is not a big increase, but a small one, like 2 GDI Objects in 5 minutes eventhough i call the function multiple times per second. I added the function down here.
Best regards, thanks for the help!

INT GetColor(INT iX, INT iY, HWND WinHandle) {


int value = 0;



Gdiplus::GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);

RECT rect;
int WindowWidth;
int WindowHeight;
if (GetWindowRect(WinHandle, &rect))
{
WindowWidth = rect.right - rect.left;
WindowHeight = rect.bottom - rect.top;
}



HDC hDDC = GetDC(WinHandle);



HDC hCDC = CreateCompatibleDC(hDDC);


HBITMAP hBMP = CreateCompatibleBitmap(hDDC, WindowWidth, WindowHeight);


SelectObject(hCDC, hBMP);


BitBlt(hCDC, 0, 0, WindowWidth, WindowHeight, hDDC, 0, 0, SRCCOPY);



Gdiplus::Bitmap *BMP = new Gdiplus::Bitmap(hBMP, NULL);


Gdiplus::Color PixelColor;
BMP->GetPixel(iX, iY, &PixelColor);

Value = PixelColor.GetValue();



ReleaseDC(WinHandle, hDDC);

DeleteDC(hDDC);


DeleteDC(hCDC);

DeleteObject(hBMP);


delete BMP;

DeleteObject(BMP);



Gdiplus::GdiplusShutdown(gdiplusToken);



return Value;

}
LastKingOfHell is offline  
Old 09/08/2019, 19:40   #2
 
elite*gold: 1476
Join Date: Nov 2017
Posts: 102
Received Thanks: 104
Add me on skype I might be able to help you
FrictionF0 is offline  
Reply


Similar Threads Similar Threads
Suche aktuelles GDIPlus include
04/22/2015 - AutoIt - 2 Replies
Heyho ich hab nur ein kleines Anliegen, kann mir jemand eine aktuelle Version der GDIPlus.au3 hochladen mitsamt der anhänge wie GDIPlusConstants.au3 etc., bei mir fehlt die _GDIPlus_ImageRotateFlip Funktion und einen offiziellen Download einer neueren .au3 hab ich auf die schnelle nicht gefunden.
GDIPlus - Bild-Objekte werden nicht gelöscht
07/14/2014 - AutoIt - 3 Replies
#include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Opt("MustDeclareVars", 1) Global $pic Global $u_pic Global $hGUI
GDIPlus Bitmap.GetHeight() liefert 0
04/30/2012 - C/C++ - 2 Replies
Hallo EPVP, Ich "spiele" mich derzeit mit GDIPlus und will die Höhe/Breite einer Bitmap ermitteln und dann in einer Messagebox auszugeben Leider liefert die Messagebox den Wert 0 aus und ich finde den Fehler einfach nicht... #include <Gdiplus.h> ... #pragma comment(lib, "gdiplus.lib")
CO Partner Memory Leak?
06/18/2006 - Conquer Online 2 - 8 Replies
Does it happen to any one else; after 5-10 mins of lvling it just ignores the mobs and random runs around.
4302 patch memory leak on hex edited exe
04/04/2006 - Conquer Online 2 - 4 Replies
I just installed Patch 4302 and i get memory leak after i hex edited the Conquer.exe.. and ini mod doesnt seem to work for me.. any one any ideas?



All times are GMT +1. The time now is 20:52.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.