Snippets
(Unterschied zwischen Versionen)
Zeile 6: | Zeile 6: | ||
DbgGuiLeak () | DbgGuiLeak () | ||
{ | { | ||
- | _guiResCount = ::GetGuiResources (::GetCurrentProcess (), | + | _guiResCount = ::GetGuiResources (::GetCurrentProcess (), GR_GDIOBJECTS); |
- | + | ||
} | } | ||
~DbgGuiLeak () | ~DbgGuiLeak () | ||
{ | { | ||
- | int leaks = ::GetGuiResources (::GetCurrentProcess (), | + | int leaks = ::GetGuiResources (::GetCurrentProcess (), GR_GDIOBJECTS) - _guiResCount; |
- | + | ||
if (leaks != 0) | if (leaks != 0) | ||
{ | { |
Version vom 07:51, 25. Sep. 2009
Finding GDI Leaks by counting GDI objects
class DbgGuiLeak { public: DbgGuiLeak () { _guiResCount = ::GetGuiResources (::GetCurrentProcess (), GR_GDIOBJECTS); } ~DbgGuiLeak () { int leaks = ::GetGuiResources (::GetCurrentProcess (), GR_GDIOBJECTS) - _guiResCount; if (leaks != 0) { std::cout << "Gui Resources Leaked: " << leaks << std::endl; } } private: unsigned _guiResCount; };