If you are using the vanilla Windows API you add a string by sending it a message. For example:-
SendMessage(hwndList, LB_ADDSTRING, 0, (LPARAM)"Hello Zaphod");
It is assumed that you have retrieved a handle to the listbox (hwndList) in the WM_INITDIALOG message of your dialog callback routine.
If you are using the Microsoft Foundation Classes then things are a lot easier. For example:-
m_ListBox.AddString("Hello Zaphod");
Again it is assumed that you have a dialog class to wrapper your dialog resource, and m_ListBox is a member variable of the class CListBox.
You can also insert strings by index rather than sorted.
HTH
Neil
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only