How to dynamically change a CComboBox from dropdown to dropdown list

How can you change the type of a CComboBox from a dropdown to a dropdownlist after a dialog box has been created? Just changing the window style from CBS_DROPDOWN to CBS_DROPDOWNLIST does not seem to be enough.
KelvinUnitAsked:
Who is Participating?
 
AlexFMConnect With a Mentor Commented:
Not all window styles can be changed dynamically. If you try this using SetWindowLong or ModifyStyle and it doesn't work, consider using another solution. For example, two combo boxes with different styles, only one of them is visible. Instead of changing the style hide one and show another.
0
 
Jaime OlivaresSoftware ArchitectCommented:
try to call this method for the ComboBox:
    ModifyStyle(CBS_DROPDOWN, CBS_DROPDOWNLIST, SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER);
and
    ModifyStyle(CBS_DROPDOWNLIST, CBS_DROPDOWN, SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER);
alternatively.
0
 
Jaime OlivaresSoftware ArchitectCommented:
Still awaiting for author feedback
0
 
KelvinUnitAuthor Commented:
I intend to ask for this question to be closed and for a refund. Jaime's answer suggests something that I have said does not work in the question and Alex is really just stating the obvious.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.