leuk_he, on Dec 20 2007, 10:14 PM, said:
Moving from morph to official because rapid mule concludes this is in official as well.
PS, @rapidmule
If you want tot debug this you can remove code until the gdi leak no longer happens.
Well since I have nothing to do on xmas except for wasting my pathetic life on
MMORPGs, I've spent sometime trying to debug this issue and here we go:
Quote
TVS_CHECKBOXES
...
Once a tree-view control is created with this style, the style cannot be removed. Instead, you must destroy the control and create a new one in its place. Destroying the tree-view control does not destroy the check box state image list. You must destroy it explicitly. Get the handle to the state image list by sending the tree-view control a TVM_GETIMAGELIST message. Then destroy the image list with ImageList_Destroy.
...
Now since I've got no clue what that means (Really the only time I code something then it's in
Perl and only small scripts). Apparently I need to add something like the following:
// => Start
HIMAGELIST handle = TreeView_GetImageList(m_wndDirectories.GetHandle(), TVSIL_STATE);
if (handle != NULL)
ImageList_Destroy(handle);
// <= End
I've no Idea where to insert the code, tried CPreferencesDlg::OnDestroy() but then I didn't figure out how to get the m_ShareSelector handle.
HWND CPPgDirectories::GetHandle()
{
return m_ShareSelector.GetSafeHwnd();
}
Seems to work fine but can't wait to learn more.