本文整理汇总了C++中ListView_DeleteItem函数的典型用法代码示例。如果您正苦于以下问题:C++ ListView_DeleteItem函数的具体用法?C++ ListView_DeleteItem怎么用?C++ ListView_DeleteItem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ListView_DeleteItem函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WmTabCommand_DeleteFunction
BOOL WmTabCommand_DeleteFunction(HWND, UINT, WPARAM, LPARAM)
{
HWND hWnd = GetPrgRes()->GetTabWindow(TabWindowFunctions::tab_functions);
HWND list = GetDlgItem(hWnd, IDC_FUNCTIONS_LIST);
int items = ListView_GetSelectedCount(list);
if( items == 0 )
// there must be at least one item selected
return true;
if( items > 1 )
{
// we're showing a message to confirm deleting
if( MessageBox( hWnd,
GetPrgRes()->GetLanguages()->GuiMessage(Languages::dialog_box_delete_function_confirm),
GetPrgRes()->GetLanguages()->GuiMessage(Languages::message_box_caption),
MB_ICONWARNING | MB_YESNO) == IDNO )
return true;
}
int id;
const int buffer_size = 300;
char * buffer = new char[buffer_size];
bool all_deleted = true;
GetPrgRes()->ReadVariablesFunctionsFromFile();
GetPrgRes()->GetThreadController()->StopCalculating();
for( id = ListView_GetItemCount(list)-1 ; id!=-1 ; --id )
{
if( ListView_GetItemState(list, id, LVIS_SELECTED) == LVIS_SELECTED )
{
ListView_GetItemText(list,id,0,buffer,buffer_size);
if( GetPrgRes()->GetFunctions()->Delete(buffer) != ttmath::err_ok )
all_deleted = false;
else
ListView_DeleteItem(list, id);
GetPrgRes()->FunctionsChanged();
}
}
GetPrgRes()->GetThreadController()->StartCalculating();
GetPrgRes()->SaveToFile();
delete [] buffer;
if( !all_deleted )
// there are some items which we've not deleted
// probably an internal error
MessageBox( hWnd,
GetPrgRes()->GetLanguages()->GuiMessage(Languages::dialog_box_function_not_all_deleted),
GetPrgRes()->GetLanguages()->GuiMessage(Languages::message_box_caption),
MB_ICONERROR);
return true;
}
示例2: UpdateListView
void UpdateListView(HWND hWnd)
{
PSY_DEV *dev;
int i, count, oldCount, type, status = 0, val;
LPTSTR name;
LVITEM lvi;
#define STR_BUF_SIZE 64
TCHAR statusStr[STR_BUF_SIZE];
if (psy_enum_init())
return;
oldCount = ListView_GetItemCount(hWnd);
count = psy_enum_get_dev_count();
for (i = 0; i < count; i++) {
if (psy_enum_get_dev_item(i, &dev))
break;
name = (LPTSTR) psy_dev_get_name(dev);
type = psy_dev_get_type(dev);
if (type == POWER_SUPPLY_TYPE_BATTERY) {
if (psy_dev_get_prop(dev, "status", &status))
break;
if (psy_dev_get_prop(dev, "capacity", &val))
break;
} else if (psy_dev_get_prop(dev, "online", &val))
break;
if (i < oldCount) {
ListView_SetItemText(hWnd, i, 0, name);
} else {
lvi.mask = LVIF_TEXT;
lvi.iItem = i;
lvi.iSubItem = 0;
lvi.pszText = name;
ListView_InsertItem(hWnd, &lvi);
}
ListView_SetItemText(hWnd, i, 1,
(LPTSTR) get_psy_type_str(type));
if (type == POWER_SUPPLY_TYPE_BATTERY)
StringCbPrintf(statusStr, sizeof(statusStr),
_T("%s (%d %%)"),
get_psy_status_str(status), val);
else
StringCbPrintf(statusStr, sizeof(statusStr),
val ? _T("On Line") : _T("Off Line"));
ListView_SetItemText(hWnd, i, 2, statusStr);
}
for (; i < oldCount; i++)
ListView_DeleteItem(hWnd, i);
psy_enum_cleanup();
}
示例3: wxCHECK_RET
void wxCheckListBox::DoDeleteOneItem(unsigned int n)
{
wxCHECK_RET( IsValid( n ), wxT("invalid index in wxCheckListBox::Delete") );
if ( !ListView_DeleteItem(GetHwnd(), n) )
{
wxLogLastError(wxT("ListView_DeleteItem"));
}
m_itemsClientData.RemoveAt(n);
}
示例4: ListView_GetItem
void VerticalFileSwitcherListView::remove(int index)
{
LVITEM item;
item.mask = LVIF_PARAM;
item.iItem = index;
ListView_GetItem(_hSelf, &item);
TaskLstFnStatus *tlfs = (TaskLstFnStatus *)item.lParam;
delete tlfs;
ListView_DeleteItem(_hSelf, index);
}
示例5: UpdateProcesses
void UpdateProcesses()
{
int i;
ULONG l;
LV_ITEM item;
LPPROCESS_PAGE_LIST_ITEM pData;
SendMessage(hProcessPageListCtrl, WM_SETREDRAW, FALSE, 0);
/* Remove old processes */
for (i = 0; i < ListView_GetItemCount(hProcessPageListCtrl); i++)
{
memset(&item, 0, sizeof (LV_ITEM));
item.mask = LVIF_PARAM;
item.iItem = i;
(void)ListView_GetItem(hProcessPageListCtrl, &item);
pData = (LPPROCESS_PAGE_LIST_ITEM)item.lParam;
if (!ProcessRunning(pData->ProcessId))
{
(void)ListView_DeleteItem(hProcessPageListCtrl, i);
HeapFree(GetProcessHeap(), 0, pData);
}
}
/* Check for difference in listview process and performance process counts */
if (ListView_GetItemCount(hProcessPageListCtrl) != PerfDataGetProcessCount())
{
/* Add new processes by checking against the current items */
for (l = 0; l < PerfDataGetProcessCount(); l++)
{
AddProcess(l);
}
}
if (TaskManagerSettings.SortColumn != -1)
{
(void)ListView_SortItems(hProcessPageListCtrl, ProcessPageCompareFunc, NULL);
}
SendMessage(hProcessPageListCtrl, WM_SETREDRAW, TRUE, 0);
/* Select first item if any */
if ((ListView_GetNextItem(hProcessPageListCtrl, -1, LVNI_FOCUSED | LVNI_SELECTED) == -1) &&
(ListView_GetItemCount(hProcessPageListCtrl) > 0) && !bProcessPageSelectionMade)
{
ListView_SetItemState(hProcessPageListCtrl, 0, LVIS_FOCUSED | LVIS_SELECTED, LVIS_FOCUSED | LVIS_SELECTED);
bProcessPageSelectionMade = TRUE;
}
/*
else
{
bProcessPageSelectionMade = FALSE;
}
*/
}
示例6: FilterInsertListItem
VOID
FilterInsertListItem(
IN HWND hWnd,
IN HWND hWndTree,
IN PFILTER_NODE Node,
IN HTREEITEM hTreeItem,
IN PWCHAR Buffer,
IN BOOLEAN Insert
)
{
PBTR_FILTER Filter;
HWND hWndList;
LVITEM lvi = {0};
LVFINDINFO lvfi = {0};
int index;
hWndList = GetDlgItem(hWnd, IDC_LIST_FILTER);
if (Insert) {
ASSERT(Node != NULL);
ASSERT(Buffer != NULL);
Filter = Node->Filter;
index = ListView_GetItemCount(hWndList);
lvi.mask = LVIF_PARAM | LVIF_TEXT;
lvi.lParam = (LPARAM)hTreeItem;
lvi.iItem = index;
lvi.iSubItem = 0;
lvi.pszText = Filter->FilterName;
ListView_InsertItem(hWndList, &lvi);
lvi.mask = LVIF_TEXT;
lvi.iSubItem = 1;
lvi.pszText = Buffer;
ListView_SetItem(hWndList, &lvi);
return;
}
//
// Delete list item, search by hTreeItem,
// note that start position is -1, not 0
//
lvfi.flags = LVFI_PARAM;
lvfi.lParam = (LPARAM)hTreeItem;
index = ListView_FindItem(hWndList, -1, &lvfi);
if (index != -1) {
ListView_DeleteItem(hWndList, index);
}
}
示例7: AddLinetoFileView
void AddLinetoFileView( HWND hDlg , char *text, int deletefirst )
{
if ( strlen( text ) > 0 ){
//ListDelString( IDC_VIEWLINES, 0 );
//ListAddString( IDC_VIEWLINES, text );
HWND hlst = GetDlgItem(hDlg, IDC_FILEVIEW);
if ( deletefirst )
ListView_DeleteItem( hlst, 1 );
AddToListView( hlst, ListView_GetItemCount(hlst), text );
}
}
示例8: KG_PROCESS_ERROR
void KUiWndFrameTabControl::OnDel()
{
KG_PROCESS_ERROR(m_hListWnd);
KG_PROCESS_ERROR(m_nCurrentItem >= 0 && m_nCurrentItem < ListView_GetItemCount(m_hListWnd));
ListView_DeleteItem(m_hListWnd, m_nCurrentItem);
m_nCurrentItem = m_nCurrentItem >= ListView_GetItemCount(m_hListWnd) ? m_nCurrentItem - 1 : m_nCurrentItem;
ListView_SetItemState(m_hListWnd,m_nCurrentItem,UINT(LVIS_SELECTED | LVIS_FOCUSED ),LVIS_SELECTED | LVIS_FOCUSED);
SaveData();
Exit0:
return;
}
示例9: FilterListOnDelete
BOOLEAN
FilterListOnDelete(
IN HWND hWnd,
IN UINT uMsg,
IN WPARAM wp,
IN LPARAM lp
)
{
int Index;
int Count;
HTREEITEM hTreeItem;
HWND hWndTree;
HWND hWndParent;
Index = ListViewGetFirstSelected(hWnd);
if (Index != -1) {
ListViewGetParam(hWnd, Index, (LPARAM *)&hTreeItem);
if (hTreeItem != NULL) {
ListView_DeleteItem(hWnd, Index);
hWndParent = GetParent(hWnd);
hWndTree = GetDlgItem(hWndParent, IDC_TREE_FILTER);
TreeView_EnsureVisible(hWndTree, hTreeItem);
if (BspIsVistaAbove()) {
TreeView_SetCheckState(hWndTree, hTreeItem, FALSE);
} else {
PostMessage(hWndParent, WM_TVN_UNCHECKITEM, (WPARAM)hTreeItem, 0);
}
Count = ListView_GetItemCount(hWnd);
//
// If the last item is deleted, start from 0
//
if (Count > Index) {
ListViewSelectSingle(hWnd, Index);
} else {
ListViewSelectSingle(hWnd, 0);
}
return TRUE;
}
}
return FALSE;
}
示例10: SongListRemove
void SongListRemove(int n, PLAYERENTRY* player)
{
if (n > -1)
{
PLAYERINFO* current = first;
PLAYERINFO* prev = NULL;
while (current != NULL)
{
if (current->n == n)
break;
else
{
prev = current;
current = current->next;
}
}
if (current != NULL)
{
PLAYERINFO* next = current->next;
while (next != NULL)
{
next->n--;
next = next->next;
}
if (player->next != NULL && player->next == current)
player->next = NULL;
if (first == current)
first = current->next;
if (prev != NULL)
{
prev->next = current->next;
if (last == current)
last = prev;
}
else
{
if (last == current)
last = NULL;
}
if (current->playing || current->pause)
current->n = -1;
else
PlayInfoRelease(current, TRUE);
ListView_DeleteItem(songlist.hWnd, n);
}
}
}
示例11: CoTaskMemFree
void CShellBrowser::RemoveItem(int iItemInternal)
{
ULARGE_INTEGER ulFileSize;
LVFINDINFO lvfi;
BOOL bFolder;
int iItem;
int nItems;
if(iItemInternal == -1)
return;
CoTaskMemFree(m_pExtraItemInfo[iItemInternal].pridl);
/* Is this item a folder? */
bFolder = (m_pwfdFiles[iItemInternal].dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ==
FILE_ATTRIBUTE_DIRECTORY;
/* Take the file size of the removed file away from the total
directory size. */
ulFileSize.LowPart = m_pwfdFiles[iItemInternal].nFileSizeLow;
ulFileSize.HighPart = m_pwfdFiles[iItemInternal].nFileSizeHigh;
m_ulTotalDirSize.QuadPart -= ulFileSize.QuadPart;
/* Locate the item within the listview.
Could use filename, providing removed
items are always deleted before new
items are inserted. */
lvfi.flags = LVFI_PARAM;
lvfi.lParam = iItemInternal;
iItem = ListView_FindItem(m_hListView,-1,&lvfi);
if(iItem != -1)
{
/* Remove the item from the listview. */
ListView_DeleteItem(m_hListView,iItem);
}
/* Invalidate the items internal data.
This will mark it as free, so that it
can be used by another item. */
m_pItemMap[iItemInternal] = 0;
nItems = ListView_GetItemCount(m_hListView);
m_nTotalItems--;
if(nItems == 0 && !m_bApplyFilter)
{
SendMessage(m_hOwner,WM_USER_FOLDEREMPTY,m_ID,TRUE);
}
}
示例12: OnDelete
BOOL OnDelete(HWND hWnd) {
HWND hWndLV = GetDlgItem(hWnd, IDC_LIST);
int nItem = ListView_GetNextItem(hWndLV, -1, LVNI_ALL | LVNI_SELECTED);
if (nItem != -1) {
if (MessageBox(hWnd, "アイテムを削除しますか。", "確認", MB_YESNO | MB_ICONQUESTION | MB_DEFBUTTON2) == IDYES) {
ListView_DeleteItem(hWndLV, nItem);
} else {
SetFocus(hWndLV);
}
}
return TRUE;
}
示例13: RemoveFromFavorites
// Remove a game from favorites
void RemoveFromFavorites() {
int iSel = SendMessage(hFavListView, LVM_GETNEXTITEM, ~0U, LVNI_FOCUSED);
ListView_DeleteItem(hFavListView, iSel);
SaveFavListAlt(); // Save the Favorite Games List
RefreshFavGameList(); // Refresh Favorite Games List
if(ListView_GetItemCount(hFavListView) == 0) {
return;
} else {
SetFocus(hFavListView);
ListView_SetItemState(hFavListView, 0, LVIS_SELECTED | LVIS_FOCUSED, 0x000F);
}
}
示例14: EndEdit
void ApplicationListDlg::OnRemoveApplBtn()
{
//Stop editing item
if (IsEditing())
EndEdit();
//Get selected item index
int idx = ListView_GetNextItem(m_hAppListWnd, (WPARAM)-1, LVNI_SELECTED);
//Remove it from the list
if (idx != -1)
ListView_DeleteItem(m_hAppListWnd, idx);
}
示例15: ProfileList_DeleteItem
/**
* name: ProfileList_DeleteItem
* desc: delete an item from the listview
* param: hList - handle to listview control
* iItem - item index
*
* return: nothing
**/
static VOID ProfileList_DeleteItem(HWND hList, INT iItem)
{
LPLCITEM pItem = ProfileList_GetItemData(hList, iItem);
if (PtrIsValid(pItem)) {
if (pItem->pszText[0])
mir_free(pItem->pszText[0]);
if (pItem->pszText[1])
mir_free(pItem->pszText[1]);
mir_free(pItem);
}
ListView_DeleteItem(hList, iItem);
}