• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ ListView_DeleteItem函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中ListView_DeleteItem函数的典型用法代码示例。如果您正苦于以下问题:C++ ListView_DeleteItem函数的具体用法?C++ ListView_DeleteItem怎么用?C++ ListView_DeleteItem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了ListView_DeleteItem函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:somyagupta,项目名称:csc444,代码行数:58,代码来源:functions.cpp


示例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();
}
开发者ID:hiro-sakamoto,项目名称:linux_emu,代码行数:56,代码来源:psyview_win.c


示例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);
}
开发者ID:0ryuO,项目名称:dolphin-avsync,代码行数:10,代码来源:checklst.cpp


示例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);
}
开发者ID:123vipulj,项目名称:notepad-plus-plus,代码行数:10,代码来源:VerticalFileSwitcherListView.cpp


示例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;
    }
    */
}
开发者ID:Moteesh,项目名称:reactos,代码行数:55,代码来源:procpage.c


示例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);
	}
}
开发者ID:John-Chan,项目名称:dprobe,代码行数:55,代码来源:filterdlg.c


示例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 );
	}
}
开发者ID:rauls,项目名称:iReporter,代码行数:11,代码来源:FileViewGUI.cpp


示例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;
}
开发者ID:viticm,项目名称:pap2,代码行数:12,代码来源:UiWndFrameTabControl.cpp


示例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;
}
开发者ID:John-Chan,项目名称:dprobe,代码行数:53,代码来源:filterdlg.c


示例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);
		}
	}
}
开发者ID:hihua,项目名称:hihuacode,代码行数:53,代码来源:SongList.cpp


示例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);
	}
}
开发者ID:hollylee,项目名称:explorerplusplus,代码行数:52,代码来源:BrowsingHandler.cpp


示例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;
}
开发者ID:sunaoka,项目名称:ygmail,代码行数:13,代码来源:SetupDlg.cpp


示例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);
	}
}
开发者ID:carstene1ns,项目名称:fbagx,代码行数:14,代码来源:favorites.cpp


示例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);
}
开发者ID:Mrunali,项目名称:Virtual-Dimention,代码行数:13,代码来源:ApplicationListDlg.cpp


示例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);
}
开发者ID:TonyAlloa,项目名称:miranda-dev,代码行数:21,代码来源:psp_profile.cpp


示例16: RemoveFromWatch

//================================================================================================
//-----------------------------+++--> Remove Timer X From Timer Watch List (Set Homeless to FALSE):
void RemoveFromWatch(HWND hWnd, HWND hList, char* szTimer, int iLx)
{
	const char szMessage[] = TEXT("Yes will cancel the timer & remove it from the Watch List\n"
							"No will remove timer from Watch List only (timer continues)\n"
							"Cancel will assume you hit delete accidentally (and do nothing)");
	char szCaption[GEN_BUFF];
	int idx;
	int id=-1;
							
	for(idx=0; idx<m_timers; ++idx) {
		if(!strcmp(szTimer, m_timer[idx].name)) {
			id=m_timer[idx].id;
			break;
		}
	}
	
	if(id==-1) { //----+++--> IF the Timer Has Expired...
		ListView_DeleteItem(hList,iLx); // Just Delete it.
		return;
	}
	
	wsprintf(szCaption, "Cancel Timer (%s) Also?", szTimer);
	
	switch(MessageBox(hWnd, szMessage, szCaption, MB_YESNOCANCEL|MB_ICONQUESTION)) {
	case IDYES:
		ListView_DeleteItem(hList, iLx);
		StopTimer(id); // Does Not Reset Active Flag!
		break;
	case IDNO:
		for(idx=0; idx<m_timers; ++idx) {
			if(!strcmp(szTimer, m_timer[idx].name)) {
				m_timer[idx].bHomeless = 0;
				ListView_DeleteItem(hList,iLx);
				break;
			}
		}
		break;
	}
}
开发者ID:andrejtm,项目名称:T-Clock,代码行数:41,代码来源:timer.c


示例17: List_DeleteSelected

/* Delete the selected frame */
BOOL List_DeleteSelected(HWND hwndApp, HWND hwndList)
{
    int items;

    /* First get the selected item */
    int index = ListView_GetNextItem(hwndList, -1, LVNI_SELECTED);

    if (index != -1)
        ListView_DeleteItem(hwndList, index);

    items = ListView_GetItemCount(hwndList);
    if (index != -1) return TRUE;
    else return FALSE;
}
开发者ID:cmjonze,项目名称:faad,代码行数:15,代码来源:id3v2tag.c


示例18: ListView_GetItemCount

BOOL ZipDlg::ListMove( BOOL blnUp)
{
	int	intSize		= ListView_GetItemCount( hwndList) ;
	bool	blnMoved	= false ;	// 動く余地があるかどうか
	int	intIndex ;
	
	vector<BOOL> vecSelected ;
	BOOL blnTop = TRUE ;

	for( int i = 0; i < intSize; i++)
	{
		intIndex = blnUp ? i : intSize - i - 1 ;
		
		if( ListView_GetItemState( hwndList, intIndex, LVIS_SELECTED))
		{
			if( !blnMoved)
			{
				continue ;
			}

			// リストビュー
			ListView_DeleteItem( hwndList, intIndex) ;

			if( blnUp) // index減少
			{
				ListAdd( vecFileList[ intIndex], intIndex - 1) ;
			}
			else
			{
				ListAdd( vecFileList[ intIndex], intIndex + 1) ;
			}

			if( blnTop)
			{
				ListView_SetItemState( hwndList, intIndex + ( blnUp ? -1 : 1), LVIS_FOCUSED, LVIS_FOCUSED) ;
				ListView_EnsureVisible( hwndList, intIndex + ( blnUp ? -1 : 1), FALSE) ;
				blnTop = FALSE ;
			}

			// ドキュメント
			ListReload() ;
		}
		else
		{
			blnMoved = true ;
		}
	}

	return TRUE ;
}
开发者ID:nitoyon,项目名称:mp3album,代码行数:50,代码来源:ZipDlg.cpp


示例19: UpdateFileInfoStatus

void UpdateFileInfoStatus(FILEINFO *pFileinfo, const HWND hwndListView)
{
    pFileinfo->status = InfoToIntValue(pFileinfo);
    SetFileInfoStrings(pFileinfo, pFileinfo->parentList);
    if(g_program_options.bHideVerified && pFileinfo->status == STATUS_OK) {
        LVFINDINFO findInfo;
        ZeroMemory(&findInfo, sizeof(LVFINDINFO));
        findInfo.flags = LVFI_PARAM;
        findInfo.lParam = (LPARAM)pFileinfo;
        int pos = ListView_FindItem(hwndListView, -1, &findInfo);
        if(pos >= 0)
            ListView_DeleteItem(hwndListView, pos);
    }
}
开发者ID:andrew-tpfc,项目名称:RapidCRC-Unicode,代码行数:14,代码来源:actfcts.cpp


示例20: GetItemIndex

int QueueWindow::RemoveQueueItem(QueueOperation * op) {
	if (!ValidType(op->GetType()))
		return -1;

	int index = GetItemIndex(op);
	if (index == -1)
		return -1;

	BOOL res = ListView_DeleteItem(m_hwnd,index);
	if (res == FALSE)
		return -1;

	return -1;
}
开发者ID:Alexey-T,项目名称:SynFTP,代码行数:14,代码来源:QueueWindow.cpp



注:本文中的ListView_DeleteItem函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ListView_GetCheckState函数代码示例发布时间:2022-05-30
下一篇:
C++ ListView_DeleteAllItems函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap