void CPropMapCtrl::OnDeleteProperty() 
{
	// Fire the Delete Property Event
	// FireDeleteProperty(m_pPropMap, NULL);
	// go through the list of properties and delete each selected one
	int iSelected = m_listCtrl.GetSelectedCount();
	if (iSelected == 0)
		return;

	CPtrArray cpaSelections;
	cpaSelections.SetSize(iSelected);
	int iItem = m_listCtrl.GetNextItem(-1, LVNI_SELECTED);
	int i = 0;
	int iLastItem;
	
	while (iItem != -1)
	{
		iLastItem = iItem;
		cpaSelections.SetAt(i++, (CPropListData *) m_listCtrl.GetItemData(iItem));
		iItem = m_listCtrl.GetNextItem(iItem, LVNI_SELECTED);
	}

	HRESULT hr = S_OK;
	BSTR bstrName = NULL;

	for (i = cpaSelections.GetSize() - 1; i > -1; i--)
	{
		CPropListData *pld = (CPropListData *) cpaSelections.GetAt(i);
		if (!pld)
			break;

		// iItem is the selected item
		BOOL bFailed = FALSE;

		bstrName = pld->m_strName.AllocSysString();

		hr = m_pPropMap->Remove(bstrName);
		if (FAILED(hr))	goto failexit;
		iLastItem--;
	}

	m_listCtrl.SelectItem(iLastItem + 1);

failexit:
	// clean up
	SAFEFREESTRING(bstrName);
}