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

C++ ListView_GetItemState函数代码示例

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

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



在下文中一共展示了ListView_GetItemState函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: GetDlgItem

void CPlayListDlg::OnDown(BOOL fVisible)
{
	HWND hwndLV = GetDlgItem(m_hWnd, IDC_PLAY_LIST);
	SetFocus(hwndLV);

	int nCount = ListView_GetItemCount(hwndLV);
	if (ListView_GetItemState(hwndLV, nCount - 1, LVIS_SELECTED))
		return;

	for (int i = nCount - 2; i >= 0; i--) {
		if (ListView_GetItemState(hwndLV, i, LVIS_SELECTED)) {
			// ListViewの更新
			TCHAR szTitle[MAX_PATH] = {0};

			LVITEM li;
			memset(&li, 0, sizeof(LVITEM));
			li.mask = LVIF_TEXT | LVIF_IMAGE;
			li.iItem = i;
			li.pszText = szTitle;
			li.cchTextMax = MAX_PATH;
			ListView_GetItem(hwndLV, &li);
			ListView_DeleteItem(hwndLV, i);
			li.iItem = i + 1;
			ListView_InsertItem(hwndLV, &li);

			// プレイリストの更新
			m_pParent->DownFile(i);
			ListView_SetItemState(hwndLV, i + 1, 
				LVIS_FOCUSED | LVIS_SELECTED, LVIS_FOCUSED | LVIS_SELECTED);

			if (fVisible)
				ListView_EnsureVisible(hwndLV, i + 1, FALSE);
		}
	}
}
开发者ID:v-zaburdaev,项目名称:Gsplayer2,代码行数:35,代码来源:PlayListDlg.cpp


示例2: ListView_GetItemCount

BOOL ZipDlg::ListDel()
{
	int intCount = ListView_GetItemCount( hwndList) ;
	BOOL blnFocus = FALSE ;
	int i;
	for( i = 0; i < intCount; i++)
	{
		// 選択されていた場合
		if( ListView_GetItemState( hwndList, intCount - i - 1, LVIS_SELECTED))
		{
			// 後ろの要素から削除
			ListView_DeleteItem( hwndList, intCount - i - 1) ;
			vector<Mp3File*>::iterator p = vecFileList.begin() + (intCount - i - 1) ;
			delete vecFileList[ intCount - i - 1] ;
			vecFileList.erase( p) ;

			continue ;
		}
	}

	// フォーカスのあるアイテムを選択
	for( i = 0; i < ListView_GetItemCount( hwndList); i++)
	{
		if( ListView_GetItemState( hwndList, i, LVIS_FOCUSED))
		{
			ListView_SetItemState( hwndList, i, LVIS_SELECTED, LVIS_SELECTED) ;
		}
	}

	EnableWindow( hwndOk, ( ListView_GetItemCount( hwndList) != 0 ? TRUE : FALSE)) ;
	return TRUE ;
}
开发者ID:nitoyon,项目名称:mp3album,代码行数:32,代码来源:ZipDlg.cpp


示例3: ListView_GetItemCount

void CPpcMainWnd::OnFileDown()
{
	if (!ListView_GetSelectedCount(m_hwndLV))
		return;

	int nCount = ListView_GetItemCount(m_hwndLV);
	if (ListView_GetItemState(m_hwndLV, nCount - 1, LVIS_SELECTED))
		return;

	for (int i = nCount - 2; i >= 0; i--) {
		if (ListView_GetItemState(m_hwndLV, i, LVIS_SELECTED))
			DownFile(i);
	}
}
开发者ID:jiangzhengwenjz,项目名称:rtoss,代码行数:14,代码来源:PpcMainWnd.cpp


示例4: ExchangeItem

void ExchangeItem(HWND hwndLV, int nItem1, int nItem2)
{
	UINT uItem1, uItem2;
	TCHAR szTitle1[MAX_PATH];
	TCHAR szTitle2[MAX_PATH];
	ListView_GetItemText(hwndLV, nItem1, 0, szTitle1, MAX_PATH);
	ListView_GetItemText(hwndLV, nItem2, 0, szTitle2, MAX_PATH);
	uItem1 = ListView_GetItemState(hwndLV, nItem1, LVIS_FOCUSED | LVIS_SELECTED);
	uItem2 = ListView_GetItemState(hwndLV, nItem2, LVIS_FOCUSED | LVIS_SELECTED);

	ListView_SetItemText(hwndLV, nItem1, 0, szTitle2);
	ListView_SetItemText(hwndLV, nItem2, 0, szTitle1);
	ListView_SetItemState(hwndLV, nItem1, uItem2, LVIS_FOCUSED | LVIS_SELECTED);
	ListView_SetItemState(hwndLV, nItem2, uItem1, LVIS_FOCUSED | LVIS_SELECTED);
}
开发者ID:jiangzhengwenjz,项目名称:rtoss,代码行数:15,代码来源:PpcMainWnd.cpp


示例5: saveSelection

void saveSelection(PCSpotify spotify, HWND hwndListView, DWORD setting)
{
	const int itemCount{ ListView_GetItemCount(hwndListView) };
	for (int i = 0; i < itemCount; i++)
	{
		if (ListView_GetItemState(hwndListView, i, LVIS_SELECTED) == LVIS_SELECTED)
		{
			TCHAR buf[MAX_PATH]{};
			LV_ITEM item{};
			item.iItem = i;
			item.iSubItem = 1;
			item.mask = LVIF_TEXT;
			item.pszText = buf;
			item.cchTextMax = ARRAYSIZE(buf);
			if (ListView_GetItem(hwndListView, &item))
			{
				std::cstring cls(item.pszText);
				if (setting == S2P_SETTING_SPOTIFY)
					spotify->setSpotifyClass(cls);

				if (setting == S2P_SETTING_PUTTY)
					spotify->setPuttyClass(cls);
			}
		}
	}
}
开发者ID:tamaroth,项目名称:Spotify2PuTTy,代码行数:26,代码来源:Settings.cpp


示例6: PhpGetStringForSelectedResults

static PPH_STRING PhpGetStringForSelectedResults(
    _In_ HWND ListViewHandle,
    _In_ PPH_LIST Results,
    _In_ BOOLEAN All
    )
{
    PH_STRING_BUILDER stringBuilder;
    ULONG i;

    PhInitializeStringBuilder(&stringBuilder, 0x100);

    for (i = 0; i < Results->Count; i++)
    {
        PPH_MEMORY_RESULT result;

        if (!All)
        {
            if (!(ListView_GetItemState(ListViewHandle, i, LVIS_SELECTED) & LVIS_SELECTED))
                continue;
        }

        result = Results->Items[i];

        PhAppendFormatStringBuilder(&stringBuilder, L"0x%Ix (%u): %s\r\n", result->Address, result->Length,
            result->Display.Buffer ? result->Display.Buffer : L"");
    }

    return PhFinalStringBuilderString(&stringBuilder);
}
开发者ID:evaluation-alex,项目名称:processhacker2,代码行数:29,代码来源:memrslt.c


示例7: ListView_GetItemCount

unsigned pListView::selection() {
  unsigned count = ListView_GetItemCount(hwnd);
  for(unsigned n = 0; n < count; n++) {
    if(ListView_GetItemState(hwnd, n, LVIS_SELECTED)) return n;
  }
  return listView.state.selection;
}
开发者ID:vgmtool,项目名称:vgmtool,代码行数:7,代码来源:list-view.cpp


示例8: GetDlgItem

void CEffectDlg::PresetOnLoad(HWND hwndDlg)
{
	HWND hwndLV = GetDlgItem(hwndDlg, IDC_LIST_PRESET);
	int nCount = ListView_GetItemCount(hwndLV);
	if (!nCount)
		return;
	
	TCHAR szPath[MAX_PATH];
	TCHAR szName[MAX_PATH];
	if (!GetPresetDir(szPath))
		return;

	for (int i = 0; i < nCount; i++) {
		if (ListView_GetItemState(hwndLV, i, LVIS_SELECTED) == LVIS_SELECTED) {
			ListView_GetItemText(hwndLV, i, 0, szName, MAX_PATH);

			_tcscat(szPath, _T("\\"));
			_tcscat(szPath, szName);
			_tcscat(szPath, _T("."));
			_tcscat(szPath, EFFECT_FILE_EXT);

			LoadPresetFile(szPath);
			return;
		}
	}
}
开发者ID:v-zaburdaev,项目名称:Gsplayer2,代码行数:26,代码来源:EffectDlgSave.cpp


示例9: wbGetListViewItemChecked

BOOL wbGetListViewItemChecked(PWBOBJ pwbo, int nItem)
{
	if(!pwbo || !pwbo->hwnd || !IsWindow(pwbo->hwnd))
		return FALSE;

	return (ListView_GetItemState(pwbo->hwnd, nItem, LVIS_STATEIMAGEMASK) & LVIS_CHECKED);
}
开发者ID:BackupTheBerlios,项目名称:winbinder-svn,代码行数:7,代码来源:wb_control_listview.c


示例10: CustomDrawNewFile

static int CustomDrawNewFile(HWND hwnd, LPNMLVCUSTOMDRAW draw)
{
    HWND hwndLV;
    switch(draw->nmcd.dwDrawStage)
    {
        case CDDS_PREPAINT :
        case CDDS_ITEMPREPAINT:
            return CDRF_NOTIFYSUBITEMDRAW;
        case CDDS_ITEMPREPAINT | CDDS_SUBITEM:
            hwndLV = GetDlgItem(hwnd, IDC_LVNEWPROJECT);
            // we do it this way so the selection won't go away when we focus another control
            if (ListView_GetItemState(hwndLV, draw->nmcd.dwItemSpec, LVIS_SELECTED) & LVIS_SELECTED)
            {
                draw->clrText = RetrieveSysColor(COLOR_HIGHLIGHTTEXT);
                draw->clrTextBk = RetrieveSysColor(COLOR_HIGHLIGHT);
            }
            else
            {
                draw->clrText = RetrieveSysColor(COLOR_WINDOWTEXT);
                draw->clrTextBk = RetrieveSysColor(COLOR_WINDOW);
            }
            return CDRF_NEWFONT;
        default:
            return CDRF_DODEFAULT;
    }
}
开发者ID:jossk,项目名称:OrangeC,代码行数:26,代码来源:prjfile.c


示例11: ListSubclassProc

int CALLBACK ListSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch (msg) {
	case WM_KEYUP:
		if (wParam == VK_ESCAPE)
			SendMessage(GetParent(hWnd), WM_CLOSE, 0, 0);

		break;

	case WM_SYSKEYDOWN:
		if (wParam == 'X')
			SendMessage(GetParent(hWnd), WM_CLOSE, 0, 0);						

		break;

	case WM_LBUTTONDBLCLK:
		int count = ListView_GetItemCount(hWnd);
		for (int i = 0; i < count; i++) {
			if (ListView_GetItemState(hWnd, i, LVIS_SELECTED)) {
				TCHAR emailID[4096]; //uhh
				ListView_GetItemText(hWnd, i, 2, emailID, sizeof(emailID));
				exchangeServer.OpenMessage(emailID);
			}
		}
		break;
	}

	return CallWindowProc(OldListProc, hWnd, msg, wParam, lParam);
}
开发者ID:0xmono,项目名称:miranda-ng,代码行数:29,代码来源:dlg_handlers.cpp


示例12: ListView_GetItemState

void CPpcMainWnd::SortFile(int nSort)
{
#define CURRENT_MASK	0x8000
	int i, nFocus = -1;
	FILEINFO* p;
	TCHAR szTitle[MAX_PATH];

	for (i = 0; i < m_pListFile->GetCount(); i++) {
		p = (FILEINFO*)m_pListFile->GetAt(i);
		p->dwUser = (i == m_nCurrent) ? CURRENT_MASK : 0;
		p->dwUser |= ListView_GetItemState(m_hwndLV, i, LVIS_FOCUSED | LVIS_SELECTED);
	}

	m_pListFile->Sort(SortCompareProc, nSort);
	for (i = 0; i < m_pListFile->GetCount(); i++) {
		p = (FILEINFO*)m_pListFile->GetAt(i);
		if (p->dwUser & CURRENT_MASK)
			m_nCurrent = i;
		GetTitle(i, szTitle);
		ListView_SetItemText(m_hwndLV, i, 0, szTitle);
		ListView_SetItemState(m_hwndLV, i, p->dwUser, LVIS_FOCUSED | LVIS_SELECTED);
		if (p->dwUser &LVIS_FOCUSED)
			nFocus = i;
	}
	if (nFocus != -1)
		ListView_EnsureVisible(m_hwndLV, nFocus, FALSE);

	UpdateTrack();
}
开发者ID:jiangzhengwenjz,项目名称:rtoss,代码行数:29,代码来源:PpcMainWnd.cpp


示例13: ListView_GetItemCount

int NListView::ListView_InvertSelection(HWND hListView)
{
	int nTotalItems = ListView_GetItemCount(hListView);

	int nSelected = 0;

	SendMessage(hListView,WM_SETREDRAW,FALSE,0);

	for(int i = 0;i < nTotalItems;i++)
	{
		if(ListView_GetItemState(hListView,i,LVIS_SELECTED) == LVIS_SELECTED)
		{
			ListView_SelectItem(hListView,i,FALSE);
		}
		else
		{
			ListView_SelectItem(hListView,i,TRUE);
			nSelected++;
		}
	}

	SendMessage(hListView,WM_SETREDRAW,TRUE,0);

	return nSelected;
}
开发者ID:Rajuk-,项目名称:explorerplusplus,代码行数:25,代码来源:ListViewHelper.cpp


示例14: CopyPopupDataToClipboard

void CopyPopupDataToClipboard(HWND hList, int selection)
{
	if (!selection)
	{
		return;
	}
	
	if (!GetOpenClipboardWindow())
	{
		if (OpenClipboard(hList))
		{
			TCHAR buffer[2048];
			buffer[0] = _T('\0');
			TCHAR *clipboard;
			int i;
			int found = 0;
			int count = ListView_GetItemCount(hList);
			int textType;
#ifdef _UNICODE
			textType = CF_UNICODETEXT;
#else
			textType = CF_TEXT;
#endif
			
			for (i = 0; i < count; i++)
			{
				if (ListView_GetItemState(hList, i, LVIS_SELECTED))
				{
					ListView_GetItemText(hList, i, selection - 100, buffer, 2048);
					found = 1;
					break;
				}
			}
			if (found)
			{
				EmptyClipboard();
				int len = (int)_tcslen(buffer);
				
				HANDLE hData = GlobalAlloc(GMEM_MOVEABLE, (len + 2) * sizeof(TCHAR));
				clipboard = (TCHAR *) GlobalLock(hData);
				_tcsncpy(clipboard, buffer, len);
				clipboard[len] = _T('\0');
				GlobalUnlock(hData);
				if (!SetClipboardData(textType, hData))
				{
					PUShowMessage("Could not set clipboard data", SM_WARNING);
				}
			}
			CloseClipboard();
		}
		else{
			PUShowMessage("Could not open clipboard", SM_WARNING);
		}
	}
	else{
		PUShowMessage("The clipboard is not available", SM_WARNING);
	}
}
开发者ID:darkscout,项目名称:sje-miranda-plugins,代码行数:58,代码来源:popup_history_dlg.cpp


示例15: 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


示例16: MainMenu_OnSelectInv

void MainMenu_OnSelectInv(HWND hwnd)
{
  for(int i = 0; i < ListView_GetItemCount(g_hListWnd); ++i) {
    int oldstate = ListView_GetItemState(g_hListWnd, i, LVIS_SELECTED);
    int newstate = (oldstate == LVIS_SELECTED ? 0 : LVIS_SELECTED);
    ListView_SetItemState(g_hListWnd, i, newstate, LVIS_SELECTED);
  }
  SetFocus(g_hListWnd);
}
开发者ID:andry-dev,项目名称:th123toolkit,代码行数:9,代码来源:mainwnd.cpp


示例17: PhpGetStringForSelectedLogEntries

static PPH_STRING PhpGetStringForSelectedLogEntries(
    __in BOOLEAN All
    )
{
    PH_STRING_BUILDER stringBuilder;
    ULONG i;

    if (ListViewCount == 0)
        return PhReferenceEmptyString();

    PhInitializeStringBuilder(&stringBuilder, 0x100);

    i = ListViewCount - 1;

    while (TRUE)
    {
        PPH_LOG_ENTRY entry;
        SYSTEMTIME systemTime;
        PPH_STRING temp;

        if (!All)
        {
            // The list view displays the items in reverse order...
            if (!(ListView_GetItemState(ListViewHandle, ListViewCount - i - 1, LVIS_SELECTED) & LVIS_SELECTED))
            {
                goto ContinueLoop;
            }
        }

        entry = PhGetItemCircularBuffer_PVOID(&PhLogBuffer, i);

        if (!entry)
            goto ContinueLoop;

        PhLargeIntegerToLocalSystemTime(&systemTime, &entry->Time);
        temp = PhFormatDateTime(&systemTime);
        PhAppendStringBuilder(&stringBuilder, temp);
        PhDereferenceObject(temp);
        PhAppendStringBuilder2(&stringBuilder, L": ");

        temp = PhFormatLogEntry(entry);
        PhAppendStringBuilder(&stringBuilder, temp);
        PhDereferenceObject(temp);
        PhAppendStringBuilder2(&stringBuilder, L"\r\n");

ContinueLoop:

        if (i == 0)
            break;

        i--;
    }

    return PhFinalStringBuilderString(&stringBuilder);
}
开发者ID:john-peterson,项目名称:processhacker,代码行数:55,代码来源:logwnd.c


示例18: ListView_GetSelection

int ListView_GetSelection(HWND hList)
{
   int nItems, i;

   nItems = ListView_GetItemCount(hList);
   for (i = 0; i < nItems; i++)
      if (ListView_GetItemState(hList, i, LVIS_SELECTED))
	 return i;

   return -1;
}
开发者ID:Anonic,项目名称:Meridian59,代码行数:11,代码来源:alias.c


示例19: ListView_GetItemState

bool
mxListView::isSelected ( int index ) const
{
	if (!d_this)
		return false;

	int state = ListView_GetItemState( d_this->d_hwnd, index, LVIS_SELECTED );
	if ( state & LVIS_SELECTED )
		return true;

	return false;
}
开发者ID:Bubbasacs,项目名称:FinalProj,代码行数:12,代码来源:mxlistview.cpp


示例20: getselectedrow

int ShortcutMapper::getselectedrow()
{
	int i,count,sel=-1;
	count=ListView_GetItemCount(hlistview);
	for(i=0;i<count;i++){
		if(ListView_GetItemState(hlistview,i,LVIS_SELECTED)==LVIS_SELECTED){
			sel=i;
			break;
		}
	}
	return sel;
}
开发者ID:pinchyCZN,项目名称:notepad,代码行数:12,代码来源:ShortcutMapper.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ ListView_GetNextItem函数代码示例发布时间:2022-05-30
下一篇:
C++ ListView_GetItem函数代码示例发布时间: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