I believe I've uncovered a GDI leak in the SetIcon method of CXTButton. The method calls LoadImage and the icon handle is passed to another overloaded version of SetIcon. That method makes a copy of the given handle, and the original handle is never destroyed (i.e. via DestroyIcon). I'm using Xtreme Toolkit Pro Version 9.70. Has this been addressed in subsequent releases?
Thanks! Scott
BOOL CXTButton::SetIcon(CSize size, LPCTSTR lpszID, LPCTSTR lpszHotID/*=NULL*/, BOOL bRedraw/*=TRUE*/) { HICON hIcon = NULL; HICON hIconHot = NULL;
// Free previous resources (if any). CleanUpGDI();
// Find the resource for the normal icon and load the image. HINSTANCE hInst = AfxFindResourceHandle(lpszID, RT_GROUP_ICON); hIcon = (HICON)::LoadImage(hInst, lpszID, IMAGE_ICON, size.cx, size.cy, LR_DEFAULTCOLOR);
// Return false if the icon handle is NULL. if (!hIcon) { TRACE1( "Failed to load Icon resource %s.\n", lpszID ); return FALSE; }
// If we are using a pushed image as well... if (lpszHotID) { // Find the resource for the pushed icon and load the image. hInst = AfxFindResourceHandle(lpszHotID, RT_GROUP_ICON); hIconHot = (HICON)::LoadImage(hInst, lpszHotID, IMAGE_ICON, size.cx, size.cy, LR_DEFAULTCOLOR);
// Return false if the icon handle is NULL. if (!hIconHot) { TRACE0( "Failed to load Icon resource.\n" ); return FALSE; } }
return CXTButton::SetIcon(size, hIcon, hIconHot, bRedraw); }
------------- Product: Xtreme Toolkit Pro Version 9.70
Platform: Windows (32bit)
Language: Visual C++ 6.0
|