Reputation: 33
Situation:
I am trying to create an dialog base application using mfc that first scan ip from range 192.168.0.x to 192.168.0.y (variable). Every ip responsed will be recorded and display on my dialog application and then they will be grouped by user. User will be using a list of combobox to group them.
Problem:
However, due to the number of response is a variable, I should create a list of variable number of combobox list and I don't know how to do it.
Any help is very appreciate.
Upvotes: 1
Views: 480
Reputation: 15375
My advice would be to use a differtent kind of UI. Either a List control or a Grid control.
In the Grid control you can use a combo box. Here a sample for this.
Or use a list control with a Combo Box. Here a sample for this.
You can also just enlarge your Dialog and just create CComboBox items per new and Create. In the Create code you can use different IDs for the command handling. With On_COMMAND_RANGE you can create a central handler.
Upvotes: 1
Reputation: 5152
Just empty your combo when you start scanning and perform a CComboBox::AddString for each ip-address that you discover
Upvotes: 1