Click to See Complete Forum and Search --> : How to change combobox to ownerdraw at runtime?
Peter Schregle
May 19th, 1999, 01:54 AM
I'd like to change a combobox control to owner-draw at runtime. In the resource script the control is layed out as a standard control.
I've experimented with setting the style bits to CBS_OWNERDRAW | CBS_HASSTRINGS but somehow this does not help.
Does anybody know the trick?
ric
May 19th, 1999, 04:21 AM
Try SetWindowLong() function
Peter Schregle
May 19th, 1999, 09:00 AM
I used SetWindowLong to or in the CBS_OWNERDRAW | CBS_HASSTRINGS styles.
Thats the code I use:
// turn to ownerdraw
DWORD dwStyle = ::GetWindowLong(hCtrl, GWL_STYLE);
dwStyle |= CBS_OWNERDRAWFIXED | CBS_HASSTRINGS;
VERIFY(0 != ::SetWindowLong(hCtrl, GWL_STYLE, dwStyle));
This code is processed in the WM_INITDIALOG message handler.
Unfortunately it doesn't work.
Anybody already done that?
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.