how to disable a button based on the list control selections in mfc

219 views Asked by At

I have 2 buttons namely "disconnect"- deletes a single variable as selected in list control and perform certain actions and "delete"-permanently deletes multiple variables as selected in a list control. my requirement is to disable the "disconnect" button if multiple selections are made.for this I need to keep the count of selections made. Can someone suggest how to do this?

1

There are 1 answers

1
mpiatek On

There is a function for that - CListCtrl::GetSelectedCount.

There is also a macro ListView_GetSelectedCount.

or you can send LVM_GETSELECTEDCOUNT message directly.