- int no_sel = (int)SendMessage(hwnd, LB_GETSELCOUNT, 0, 0);
- if (no_sel == 0)
- return 0;
- nonConst->m_selections = new int[no_sel];
- SendMessage(hwnd, LB_GETSELITEMS, no_sel, (LONG)m_selections);
- *list_selections = m_selections;
+ int no_sel = ListBox_GetSelCount(hwnd);
+ if (no_sel != 0) {
+ int *selections = new int[no_sel];
+ if ( ListBox_GetSelItems(hwnd, no_sel, selections) == LB_ERR ) {
+ wxFAIL_MSG("This listbox can't have single-selection style!");
+ }
+
+ aSelections.Alloc(no_sel);
+ for ( int n = 0; n < no_sel; n++ )
+ aSelections.Add(selections[n]);
+
+ delete [] selections;
+ }
+