当前位置: 首页>>代码示例>>C++>>正文


C++ ListView_GetSelectedCount函数代码示例

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


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

示例1: onDependenciesPage_ContextMenu

/// Function name  : onDependenciesPage_ContextMenu
// Description     : Display the ScriptDependencies or VariableDependencies Popup Menu
// 
// SCRIPT_DOCUMENT*  pDocument : [in] Script document data
// HWND              hCtrl     : [in] Window handle of the control sending the message
// CONST UINT        iCursorX  : [in] Screen co-ordinate cursor X position
// CONST UINT        iCursorY  : [in] Screen co-ordinate cursor Y position
// 
// Return Value   : TRUE
// 
BOOL  onDependenciesPage_ContextMenu(SCRIPT_DOCUMENT*  pDocument, HWND  hCtrl, CONST UINT  iCursorX, CONST UINT  iCursorY)
{
   CUSTOM_MENU*  pCustomMenu;    // Custom Popup menu
   UINT          iSubMenuID;     // Popup submenu ID

   // [TRACK]
   CONSOLE_ACTION();

   // Determine submenu
   switch (GetWindowID(hCtrl))
   {
   /// [LISTVIEW] Display the appropriate popup menu
   case IDC_DEPENDENCIES_LIST:   iSubMenuID = IDM_DEPENDENCIES_POPUP;  CONSOLE("Displaying dependencies menu");  break;
   case IDC_VARIABLES_LIST:      iSubMenuID = IDM_VARIABLES_POPUP;     CONSOLE("Displaying variables menu");     break;
   case IDC_STRINGS_LIST:        iSubMenuID = IDM_STRINGS_POPUP;       CONSOLE("Displaying strings menu");       break;
   default:                      return FALSE;
   }

   // Create Dependencies Custom Popup menu
   pCustomMenu = createCustomMenu(TEXT("SCRIPT_MENU"), TRUE, iSubMenuID);

   /// [DEPENDENCIES] Disable 'Load script' if no item is selected
   if (GetWindowID(hCtrl) == IDC_DEPENDENCIES_LIST)
      EnableMenuItem(pCustomMenu->hPopup, IDM_DEPENDENCIES_LOAD, (ListView_GetSelectedCount(hCtrl) > 0 ? MF_ENABLED : MF_DISABLED));

   /// Display context menu
   TrackPopupMenu(pCustomMenu->hPopup, TPM_TOPALIGN WITH TPM_LEFTALIGN, iCursorX, iCursorY, NULL, GetParent(hCtrl), NULL);

   // Cleanup and return TRUE
   deleteCustomMenu(pCustomMenu);
   return TRUE;
}
开发者ID:nick-crowley,项目名称:X-Studio,代码行数:42,代码来源:Properties+Dialog+Dependencies.cpp

示例2: GetDlgItem

void OBS::SelectSources()
{
    if(scene)
        scene->DeselectAll();

    HWND hwndSources = GetDlgItem(hwndMain, ID_SOURCES);
    UINT numSelected = ListView_GetSelectedCount(hwndSources);

    if(numSelected)
    {
        List<UINT> selectedItems;
        selectedItems.SetSize(numSelected);
        //SendMessage(hwndSources, LB_GETSELITEMS, numSelected, (LPARAM)selectedItems.Array());

        if(scene)
        {
            int iPos = ListView_GetNextItem(hwndSources, -1, LVNI_SELECTED);
            while (iPos != -1)
            {
                SceneItem *sceneItem = scene->GetSceneItem(iPos);
                sceneItem->bSelected = true;
                
                iPos = ListView_GetNextItem(hwndSources, iPos, LVNI_SELECTED);
            }
        }
    }
}
开发者ID:SeargeDP,项目名称:OBS,代码行数:27,代码来源:OBS.cpp

示例3: ProcessPage_OnSetAffinity

void ProcessPage_OnSetAffinity(void)
{
    LV_ITEM            lvitem;
    ULONG            Index;
    DWORD            dwProcessId;
    TCHAR            strErrorText[260];

    for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++) {
        memset(&lvitem, 0, sizeof(LV_ITEM));
        lvitem.mask = LVIF_STATE;
        lvitem.stateMask = LVIS_SELECTED;
        lvitem.iItem = Index;
        SendMessage(hProcessPageListCtrl, LVM_GETITEM, 0, (LPARAM) &lvitem);
        if (lvitem.state & LVIS_SELECTED)
            break;
    }
    dwProcessId = PerfDataGetProcessId(Index);
    if ((ListView_GetSelectedCount(hProcessPageListCtrl) != 1) || (dwProcessId == 0))
        return;
    hProcessAffinityHandle = OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_SET_INFORMATION, FALSE, dwProcessId);
    if (!hProcessAffinityHandle) {
        GetLastErrorText(strErrorText, 260);
        MessageBox(hMainWnd, strErrorText, _T("Unable to Access or Set Process Affinity"), MB_OK|MB_ICONSTOP);
        return;
    }
    DialogBox(hInst, MAKEINTRESOURCE(IDD_AFFINITY_DIALOG), hMainWnd, AffinityDialogWndProc);
    if (hProcessAffinityHandle)    {
        CloseHandle(hProcessAffinityHandle);
        hProcessAffinityHandle = NULL;
    }
}
开发者ID:WASSUM,项目名称:longene_travel,代码行数:31,代码来源:affinity.c

示例4: EnableDisableCtrls

static void EnableDisableCtrls(HWND hwndDlg)
{
	BOOL enabled = IsDlgButtonChecked(hwndDlg, IDC_AUTO_USER);
	EnableWindow(GetDlgItem(hwndDlg, IDC_LANGUAGE_L), enabled);
	EnableWindow(GetDlgItem(hwndDlg, IDC_LANGUAGE), enabled);
	EnableWindow(GetDlgItem(hwndDlg, IDC_REPLACEMENTS), enabled);
	EnableWindow(GetDlgItem(hwndDlg, IDC_ADD), enabled);
	EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT), enabled);
	EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVE), enabled);
	if (!enabled)
		return;

	HWND hList = GetDlgItem(hwndDlg, IDC_REPLACEMENTS);
	EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT), ListView_GetSelectedCount(hList) == 1);
	EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVE), ListView_GetSelectedCount(hList) > 0);
}
开发者ID:MrtsComputers,项目名称:miranda-ng,代码行数:16,代码来源:options.cpp

示例5: if

void pListView::onChange(LPARAM lparam) {
  LPNMLISTVIEW nmlistview = (LPNMLISTVIEW)lparam;
  if(!(nmlistview->uChanged & LVIF_STATE)) return;

  unsigned selection = nmlistview->iItem;
  unsigned imagemask = ((nmlistview->uNewState & LVIS_STATEIMAGEMASK) >> 12) - 1;
  if(imagemask == 0 || imagemask == 1) {
    if(!locked) {
      listView.state.checked[selection] = !listView.state.checked[selection];
      if(listView.onToggle) listView.onToggle(selection);
    }
  } else if((nmlistview->uOldState & LVIS_FOCUSED) && !(nmlistview->uNewState & LVIS_FOCUSED)) {
    lostFocus = true;
    listView.state.selected = false;
    listView.state.selection = 0;
  } else if(!(nmlistview->uOldState & LVIS_SELECTED) && (nmlistview->uNewState & LVIS_SELECTED)) {
    lostFocus = false;
    listView.state.selected = true;
    listView.state.selection = selection;
    if(!locked && listView.onChange) listView.onChange();
  } else if(!lostFocus && !listView.state.selected) {
    lostFocus = false;
    listView.state.selected = false;
    listView.state.selection = 0;
    if(!locked && listView.onChange) listView.onChange();
  } else if(listView.selected() && ListView_GetSelectedCount(hwnd) == 0) {
    listView.state.selected = false;
    listView.state.selection = 0;
    if(!locked && listView.onChange) listView.onChange();
  }
}
开发者ID:quequotion,项目名称:higan-qq,代码行数:31,代码来源:list-view.cpp

示例6: ListView_GetSelectedCount

int mxListView::getNumSelected() const
{
	if (!d_this)
		return 0;

	return ListView_GetSelectedCount( d_this->d_hwnd );
}
开发者ID:Bubbasacs,项目名称:FinalProj,代码行数:7,代码来源:mxlistview.cpp

示例7: CreateChecksumFiles

/*****************************************************************************
DWORD CreateChecksumFiles(CONST HWND arrHwnd[ID_NUM_WINDOWS], CONST UINT uiMode)
	arrHwnd		: (IN) array with window handles
	uiMode		: (IN) create MD5/SFV/SHA1 files

Return Value:
	returns NOERROR or GetLastError()

Notes:
	- wrapper for the three parameter version
	- checks if selected files have the necessary info
	- calls FillFinalList to get its list
*****************************************************************************/
DWORD CreateChecksumFiles(CONST HWND arrHwnd[ID_NUM_WINDOWS], CONST UINT uiMode)
{
	list<FILEINFO*> finalList;
	DWORD checkReturn;
	TCHAR szErrorMessage[MAX_PATH_EX];

	// check if there are any item in our list (without checking an access violation could occur)
	if(ListView_GetItemCount(arrHwnd[ID_LISTVIEW]) == 0)
		return NOERROR;

	if(CheckIfRehashNecessary(arrHwnd,uiMode))
		return NOERROR;

	FillFinalList(arrHwnd[ID_LISTVIEW],&finalList,ListView_GetSelectedCount(arrHwnd[ID_LISTVIEW]));
	if(finalList.size()>1) {
		finalList.sort(ListPointerCompFunction);
		finalList.unique(ListPointerUniqFunction);
	}

	if((checkReturn = CreateChecksumFiles(arrHwnd,uiMode,&finalList)) != NOERROR) {
		StringCchPrintf(szErrorMessage, MAX_PATH_EX,
							TEXT("Error %u occured during checksum file creation"),
							checkReturn);
		MessageBox(arrHwnd[ID_MAIN_WND], szErrorMessage, TEXT("Error"), MB_OK);
	}

	return checkReturn;
}
开发者ID:andrew-tpfc,项目名称:RapidCRC-Unicode,代码行数:41,代码来源:actfcts.cpp

示例8: ShowWindowPropertyEditor

void ShowWindowPropertyEditor(HWND hwndParent, HWND hwndTarget, BOOL bAddNew)
{
	HWND hwndList;
	LVITEM lvitem;
	PropertyEditState state;

	state.hwndTarget = hwndTarget;
	state.bAddNew = bAddNew;

	if(!bAddNew)
	{
		hwndList = GetDlgItem(hwndParent, IDC_LIST1);

		if(ListView_GetSelectedCount(hwndList) != 1)
			return;

		lvitem.mask = LVIF_TEXT | LVIF_PARAM;
		lvitem.iItem = ListView_GetNextItem(hwndList, -1, LVNI_SELECTED);
		lvitem.iSubItem = 0;
		lvitem.pszText = state.szString;
		lvitem.cchTextMax = 256;

		ListView_GetItem(hwndList, &lvitem);

		state.aAtom = (ATOM)lvitem.lParam;
	}

	DialogBoxParam(GetModuleHandle(0), MAKEINTRESOURCE(IDD_PROPERTY_EDIT), hwndParent, PropertyEditProc, (LPARAM)&state);

	// Update the main display 
	SetPropertyInfo(hwndTarget);
}
开发者ID:HoMeCracKeR,项目名称:winspy,代码行数:32,代码来源:PropertyEdit.c

示例9: DirList_GetItemEx

//  Retrieves extended infomration on a dirlist item
int DirList_GetItemEx(HWND hwnd, int iItem, LPWIN32_FIND_DATA pfd) {

    LV_ITEM lvi;
    LPLV_ITEMDATA lplvid;

    if (iItem == -1) {

        if (ListView_GetSelectedCount(hwnd))

            iItem = ListView_GetNextItem(hwnd, -1, LVNI_ALL | LVNI_SELECTED);

        else

            return (-1);
    }

    lvi.mask = LVIF_PARAM;
    lvi.iItem = iItem;
    lvi.iSubItem = 0;

    if (!ListView_GetItem(hwnd, &lvi))
        return (-1);

    lplvid = (LPLV_ITEMDATA)lvi.lParam;

    if (NOERROR == SHGetDataFromIDList(lplvid->lpsf, lplvid->pidl, SHGDFIL_FINDDATA, pfd,
                                       sizeof(WIN32_FIND_DATA)))
        return iItem;

    else
        return (-1);
}
开发者ID:vehar,项目名称:velociraptor8,代码行数:33,代码来源:Dlapi.cpp

示例10: ListView_GetSelectedCount

LRESULT CVideoMarkup::OnBeginDrag(int idCtrl, LPNMHDR pnmh, BOOL&) {
    POINT p;
    HIMAGELIST hImageListSingle, hImageListMerged;

    int numSelected = ListView_GetSelectedCount(m_sampleListView);
    int iSelection = -1;
    for (int iIndex=0; iIndex<numSelected; iIndex++) {
        iSelection = ListView_GetNextItem(m_sampleListView, iSelection, LVNI_SELECTED);
        if (iIndex == 0) { // first selected icon
            hDragImageList = ListView_CreateDragImage(m_sampleListView, iSelection, &p);
        } else { // subsequent icons
            hImageListSingle = ListView_CreateDragImage(m_sampleListView, iSelection, &p);
            hImageListMerged = ImageList_Merge(hDragImageList, 0, hImageListSingle, 0, iIndex*3, iIndex*3);
            ImageList_Destroy(hDragImageList);
            ImageList_Destroy(hImageListSingle);
            hDragImageList = hImageListMerged;
        }
    }

    ImageList_BeginDrag(hDragImageList, 0, LISTVIEW_SAMPLE_X/2, LISTVIEW_SAMPLE_Y/2);
    POINT pt = ((NM_LISTVIEW*)pnmh)->ptAction;
    RECT listViewRect;
    m_sampleListView.GetClientRect(&listViewRect);
    m_sampleListView.ClientToScreen(&pt);
    m_sampleListView.ClientToScreen(&listViewRect);

    ImageList_DragEnter(GetDesktopWindow(), pt.x, pt.y);
    draggingIcon = TRUE;
    SetCapture();
    return 0;
}
开发者ID:gotomypc,项目名称:eyepatch,代码行数:31,代码来源:VideoMarkup.cpp

示例11: ProcessPageUpdate

void ProcessPageUpdate(void)
{
    /* Enable or disable the "End Process" button */
    if (ListView_GetSelectedCount(hProcessPageListCtrl))
        EnableWindow(hProcessPageEndProcessButton, TRUE);
    else
        EnableWindow(hProcessPageEndProcessButton, FALSE);
}
开发者ID:Moteesh,项目名称:reactos,代码行数:8,代码来源:procpage.c

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

示例13: AddSelectedGroupsToUser

static BOOL
AddSelectedGroupsToUser(HWND hwndDlg,
                        PMEMBERSHIP_USER_DATA pUserData)
{
    HWND hwndLV;
    INT nItem;
    TCHAR szGroupName[UNLEN];
    BOOL bResult = FALSE;
    BOOL bFound;
    DWORD i;
    LOCALGROUP_MEMBERS_INFO_3 memberInfo;
    NET_API_STATUS status;

    hwndLV = GetDlgItem(hwndDlg, IDC_USER_ADD_MEMBERSHIP_LIST);

    if (ListView_GetSelectedCount(hwndLV) > 0)
    {
        nItem = ListView_GetNextItem(hwndLV, -1, LVNI_SELECTED);
        while (nItem != -1)
        {
            /* Get the new user name */
            ListView_GetItemText(hwndLV,
                                 nItem, 0,
                                 szGroupName,
                                 UNLEN);

            bFound = FALSE;
            for (i = 0; i < pUserData->dwGroupCount; i++)
            {
                if (_tcscmp(pUserData->pGroupData[i].lgrui0_name, szGroupName) == 0)
                    bFound = TRUE;
            }

            if (!bFound)
            {
                memberInfo.lgrmi3_domainandname = pUserData->szUserName;

                status = NetLocalGroupAddMembers(NULL, szGroupName, 3,
                                                 (LPBYTE)&memberInfo, 1);
                if (status == NERR_Success)
                {
                    DebugPrintf(_TEXT("Selected group: %s"), szGroupName);
                    bResult = TRUE;
                }
                else
                {
                    TCHAR szText[256];
                    wsprintf(szText, TEXT("Error: %u"), status);
                    MessageBox(NULL, szText, TEXT("NetLocalGroupAddMembers"), MB_ICONERROR | MB_OK);
                }
            }

            nItem = ListView_GetNextItem(hwndLV, nItem, LVNI_SELECTED);
        }
    }

    return bResult;
}
开发者ID:mutoso-mirrors,项目名称:reactos,代码行数:58,代码来源:userprops.c

示例14: ApplicationPageShowContextMenu2

void ApplicationPageShowContextMenu2(void)
{
    HMENU  hMenu;
    HMENU  hSubMenu;
    POINT  pt;

    GetCursorPos(&pt);

    hMenu = LoadMenuW(hInst, MAKEINTRESOURCEW(IDR_APPLICATION_PAGE_CONTEXT2));
    hSubMenu = GetSubMenu(hMenu, 0);

    if (ListView_GetSelectedCount(hApplicationPageListCtrl) == 1)
    {
        EnableMenuItem(hSubMenu, ID_WINDOWS_TILEHORIZONTALLY, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
        EnableMenuItem(hSubMenu, ID_WINDOWS_TILEVERTICALLY, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
        EnableMenuItem(hSubMenu, ID_WINDOWS_MINIMIZE, MF_BYCOMMAND|MF_ENABLED);
        EnableMenuItem(hSubMenu, ID_WINDOWS_MAXIMIZE, MF_BYCOMMAND|MF_ENABLED);
        EnableMenuItem(hSubMenu, ID_WINDOWS_CASCADE, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
        EnableMenuItem(hSubMenu, ID_WINDOWS_BRINGTOFRONT, MF_BYCOMMAND|MF_ENABLED);
    }
    else if (ListView_GetSelectedCount(hApplicationPageListCtrl) > 1)
    {
        EnableMenuItem(hSubMenu, ID_WINDOWS_TILEHORIZONTALLY, MF_BYCOMMAND|MF_ENABLED);
        EnableMenuItem(hSubMenu, ID_WINDOWS_TILEVERTICALLY, MF_BYCOMMAND|MF_ENABLED);
        EnableMenuItem(hSubMenu, ID_WINDOWS_MINIMIZE, MF_BYCOMMAND|MF_ENABLED);
        EnableMenuItem(hSubMenu, ID_WINDOWS_MAXIMIZE, MF_BYCOMMAND|MF_ENABLED);
        EnableMenuItem(hSubMenu, ID_WINDOWS_CASCADE, MF_BYCOMMAND|MF_ENABLED);
        EnableMenuItem(hSubMenu, ID_WINDOWS_BRINGTOFRONT, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
    }
    else
    {
        EnableMenuItem(hSubMenu, ID_WINDOWS_TILEHORIZONTALLY, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
        EnableMenuItem(hSubMenu, ID_WINDOWS_TILEVERTICALLY, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
        EnableMenuItem(hSubMenu, ID_WINDOWS_MINIMIZE, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
        EnableMenuItem(hSubMenu, ID_WINDOWS_MAXIMIZE, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
        EnableMenuItem(hSubMenu, ID_WINDOWS_CASCADE, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
        EnableMenuItem(hSubMenu, ID_WINDOWS_BRINGTOFRONT, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
    }

    SetMenuDefaultItem(hSubMenu, ID_APPLICATION_PAGE_SWITCHTO, MF_BYCOMMAND);

    TrackPopupMenu(hSubMenu, TPM_LEFTALIGN|TPM_TOPALIGN|TPM_LEFTBUTTON, pt.x, pt.y, 0, hMainWnd, NULL);

    DestroyMenu(hMenu);
}
开发者ID:hoangduit,项目名称:reactos,代码行数:45,代码来源:applpage.c

示例15: lv_get_selection_pos

/* Returns a selected item or -1 if no selection.
   Assumes that the list is single-sel */
int lv_get_selection_pos(HWND hwnd)
{
    int selection;
    int selected_count = ListView_GetSelectedCount(hwnd);
    assert(selected_count <= 1);
    if (0 == selected_count)
        return -1;
    selection = ListView_GetSelectionMark(hwnd);
    return selection;
}
开发者ID:wzhsunn,项目名称:SumatraPDF_0.6_Source,代码行数:12,代码来源:win_util.c


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