thread116-23314
I think more context is needed for this tip. If you're returning a brush from an override of CDialog::OnCtlColor(), you don't want the CBrush object destroyed, do you? In my app, I create and destroy the CBrush objects along with the dialog box. In OnCtlColor(), I found that I couldn't create an array of CBrush objects, so I created a static array of pointers to the CBrush objects. I select the array element based on the control ID, then dereference it to get the brush.
I think more context is needed for this tip. If you're returning a brush from an override of CDialog::OnCtlColor(), you don't want the CBrush object destroyed, do you? In my app, I create and destroy the CBrush objects along with the dialog box. In OnCtlColor(), I found that I couldn't create an array of CBrush objects, so I created a static array of pointers to the CBrush objects. I select the array element based on the control ID, then dereference it to get the brush.