Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
In the last couple of days i have been testing my application for GDI Leaks, and i have a strange problem. When i return my brush to the system from the WM_CTLCOLORBTN message, all the buttons to which is call is associated show leaks, when i draw the mouse over them, here how i call it
[color=Purple]case WM_CTLCOLORBTN :
bgColor = RGB(061, 067, 113);
return (LRESULT) CreateSolidBrush (bgColor) ;
if i call it
case WM_CTLCOLORBTN :
hBrush = CreateSolidBrush (RGB(61, 67, 113)) ;
return (LRESULT) hBrush ;
its still the same, i called function DeleteBrush() before returning the brush just to test it, and sure enough the leaks stopped, i cannot delete the brush after it is returned. i read somewhere that you can avoid it by setting up the GDI Objects in the WM_CREATE or WM_INITDIALOG call, then releasing them on WM_DESTROY, but this just makes my application crash on startup. i would appreciate any help on this truly weird matter. If there is any more information i can offer, please let me know.