XT Knowledge Base
Hauptseite | Über | Hilfe | FAQ | Spezialseiten | Anmelden

Druckversion | Impressum | Datenschutz | Aktuelle Version

Snippets

(Unterschied zwischen Versionen)

(Finding GDI Leaks by counting GDI objects)
Zeile 21: Zeile 21:
</pre>
</pre>
Quelle: [http://www.relisoft.com/win32/gdileaks.html Reliable Software - GDI Leaks]
Quelle: [http://www.relisoft.com/win32/gdileaks.html Reliable Software - GDI Leaks]
 +
Also Useful: [http://www.freedownloadmanager.org/downloads/GDIView_49337_p/free.htm GDIView] (Tool which shows which GDI resources are allocated from which process)

Version vom 08:26, 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;
};

Quelle: Reliable Software - GDI Leaks Also Useful: GDIView (Tool which shows which GDI resources are allocated from which process)