Is there a way to modify a window's style (CWnd base type) after it has been created? Here's what I've been doing, and it doesn't seem to do anything. I'm using MFC to create my windows.
Now when I run this, result gets the value of 1, which according to the help files means it successfully modified the style. Yet when I go to click on stuff in the list box, I can't select more than one item. If I set the LBS_EXTENDEDSEL flag when using the resource editor, it lets me select more than one item in the box, but using this way it doesn't.
// Assume myBox is a CListBox, already created
result = myBox.ModifyStyle(0, LBS_EXTENDEDSEL, 0);
Depending on what I'm sticking in myBox, then I may or may not want the user to be able to select more than 1 item. Any way to do this, other than making 2 list box's and hiding one?
Came up with something...
I can't seem get get a hold of a CListCtrl, the help files say that belongs to a CListView, and I'm using a CListBox, so I dont think I can use that. When searching the web more trying to find some way to do it, I came across a brief tutorial that says its impossible to modify the style after its been created, and it suggested destroying and recreating the box every time you wanted a style. So I played around with creating a CListBox at run time, and managed to get it to do what I want. Takes a little bit more coding, but it seems to work.
Thanks for suggestions though.