Prachi Geda
Prachi Geda

Reputation: 21

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

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?

Upvotes: 0

Views: 224

Answers (1)

mpiatek
mpiatek

Reputation: 1343

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

There is also a macro ListView_GetSelectedCount.

or you can send LVM_GETSELECTEDCOUNT message directly.

Upvotes: 1

Related Questions