| 114 | } |
| 115 | |
| 116 | int CMyListCtrl::AddItem(char *name, int num) { |
| 117 | int item_count = GetItemCount(); |
| 118 | |
| 119 | int added = InsertItem(item_count, name); |
| 120 | if (added == -1) { |
| 121 | return -1; |
| 122 | } |
| 123 | |
| 124 | bool ret = CMyListCtrl::SetItem(added, num); |
| 125 | |
| 126 | if (!ret) { |
| 127 | DeleteItem(added); |
| 128 | return -1; |
| 129 | } |
| 130 | |
| 131 | // all went ok |
| 132 | return added; |
| 133 | } |
| 134 | |
| 135 | bool CMyListCtrl::GetItem(int item, char *name, char *state) { |
| 136 | int item_count = GetItemCount(); |