How to make only certain ListBox items not selectable?

83 views Asked by At

The ListBox window is created like this:

hList = CreateWindowEx(WS_EX_CLIENTEDGE ,"LISTBOX",NULL,
    WS_VISIBLE | WS_BORDER | WS_CHILD | ES_CENTER |WS_HSCROLL|WS_VSCROLL,
    20, 55, 200, 120,hWindow, (HMENU)ID_LIST, hInstance, 0);

It has properties which can be defined, like WS_VISIBLE and so on, one of which is LBS_NOSEL to remove selection or focusing on an item in the list, but this apply to all the items in the list, so either all can be seleted when LBS_NOSEL is not added just like the above code, or when provided all items cannot be selected.

What I want is: only certain items not to be selected. How do I achieve that?

I add items to the ListBox with SendMessage like this:

SendMessage(hList, LB_ADDSTRING , 0, (LPARAM)"my text goes here");
0

There are 0 answers