void GeneralPage::loadPage() { int index = -1; ListView_DeleteAllItems(m_hListOptions); // option: auto-start server on startup index = WinUtil::ListViewUtil::insertItem(m_hListOptions,0,WinUtil::ResourceUtil::loadString(IDS_SETTINGS_AUTOSTART).c_str(),NULL); if ( SettingsManager::getInstance()->getBool(SettingsManager::AUTOSTART)==true ) { ListView_SetCheckState(m_hListOptions,index,true); } // option: automatically check for updates index = WinUtil::ListViewUtil::insertItem(m_hListOptions,1,WinUtil::ResourceUtil::loadString(IDS_SETTINGS_CHECKFORUPDATES).c_str(),NULL); if ( SettingsManager::getInstance()->getBool(SettingsManager::CHECKFORUPDATES)==true ) { ListView_SetCheckState(m_hListOptions,index,true); } // option: confirm on application exit index = WinUtil::ListViewUtil::insertItem(m_hListOptions,2,WinUtil::ResourceUtil::loadString(IDS_SETTINGS_CONFIRMEXIT).c_str(),NULL); if ( SettingsManager::getInstance()->getBool(SettingsManager::CONFIRMEXIT)==true ) { ListView_SetCheckState(m_hListOptions,index,true); } // option: minimize to tray index = WinUtil::ListViewUtil::insertItem(m_hListOptions,3,WinUtil::ResourceUtil::loadString(IDS_SETTINGS_MINIMIZETOTRAY).c_str(),NULL); if ( SettingsManager::getInstance()->getBool(SettingsManager::MINIMIZETOTRAY)==true ) { ListView_SetCheckState(m_hListOptions,index,true); } }
void Twindow::lvSwapItems(int id,int i1,int i2) { HWND hlv=GetDlgItem(m_hwnd,id); LVITEM lvi1; char_t text1[256]; int check1; lvi1.mask=LVIF_PARAM|LVIF_STATE|LVIF_TEXT; lvi1.iItem=i1; lvi1.iSubItem=0; lvi1.pszText=text1; lvi1.cchTextMax=256; ListView_GetItem(hlv,&lvi1); check1=ListView_GetCheckState(hlv,i1); LVITEM lvi2; char_t text2[256]; int check2; lvi2.mask=LVIF_PARAM|LVIF_STATE|LVIF_TEXT; lvi2.iItem=i2; lvi2.iSubItem=0; lvi2.pszText=text2; lvi2.cchTextMax=256; ListView_GetItem(hlv,&lvi2); check2=ListView_GetCheckState(hlv,i2); std::swap(lvi1.iItem,lvi2.iItem); ListView_SetItem(hlv,&lvi1); ListView_SetCheckState(hlv,i1,check2); ListView_SetItem(hlv,&lvi2); ListView_SetCheckState(hlv,i2,check1); lvSetSelItem(id,i2); ListView_EnsureVisible(hlv,i2,FALSE); }
void LVItemSetCheckAll(HWND hWnd,BOOL bFlag) { INT iItem,iMax; iMax=ListView_GetItemCount(hWnd); if (!iMax) return; for (iItem=0;iItem<iMax;iItem++) { BOOL bNow=ListView_GetCheckState(hWnd,iItem); if (!bFlag&&bNow) ListView_SetCheckState(hWnd,iItem,false); if (bFlag&&!bNow) ListView_SetCheckState(hWnd,iItem,true); } }
void mm_mod_list_install_mod(mm_mod_item *mod_item, int listIndex) { // alright hide the mod file list window thing mm_hide_mod_install_files(); // go through and check for errors char errorMessage[MAX_PATH] = { 0 }; // check the game directory exists if (!mm_has_game_directory()) { // throw an error MessageBox(mm_mod_list, _TEXT("Unable to install mod.\nPlease make sure that your game directory has been set."), _TEXT("An error occured"), MB_OK | MB_ICONERROR); // check the checkbox again ListView_SetCheckState(mm_mod_list , listIndex, false); return; } // check the backup directory exists if (!mm_has_backup_directory()) { // throw an error MessageBox(mm_mod_list, _TEXT("Unable to install mod.\nPlease make sure that your backup directory has been set."), "An error occured", MB_OK | MB_ICONERROR); // check the checkbox again ListView_SetCheckState(mm_mod_list, listIndex, false); return; } // check that we're not conflicting if we're installing mm_installed_mod *conflicting_mod = 0; if ((conflicting_mod = mm_is_unique_mod(mod_item)) != NULL) { // throw an error sprintf(errorMessage, "Unable to install %s.\n\nThis mod has files that conflict with:\n%s.\n\nPlease uninstall that mod before installing this one.", mod_item->mod_name, conflicting_mod->file_path); MessageBox(mm_mod_list, _TEXT(errorMessage), "Mod conflict", MB_OK | MB_ICONERROR); // check the checkbox again ListView_SetCheckState(mm_mod_list, listIndex, false); return; } mm_install_mod(mod_item); }
void UserSetupPage::loadPage(User *pUser) { SetWindowText(m_hEditName,pUser->getName().c_str()); if ( !pUser->getPassword().empty() ) { SetWindowText(m_hEditPassword,ENCRYPTED_PASSWORD.c_str()); } Button_SetCheck(m_hCheckDisabled,pUser->isDisabled()); m_groups = UserManager::getInstance()->getGroups(); // add all groups to list std::list<Group>::iterator iter; for ( iter=m_groups.begin(); iter!=m_groups.end(); iter++ ) { // add group to list with group instance as lparam int index = WinUtil::ListViewUtil::insertItem(m_hListGroups,-1, iter->getName().c_str(),(LPARAM)&(*iter)); // check if user is a member of this group if ( pUser->isMemberOf(iter->getGuid()) ) { ListView_SetCheckState(m_hListGroups,index,true); } } }
// Add recourd into List-View // [in] int : Index // [in] wchar_t* : Name of record // [in] wchar_t* : Description // [in] int : Status // [out] Nothing void StkThreadGuiManager::AddRecordToListView(int Index, wchar_t* Na, wchar_t* De) { LVITEM LvItm; for (int ColumnLoop = 0; ColumnLoop < 4; ColumnLoop++) { ZeroMemory(&LvItm, sizeof(LvItm)); LvItm.iItem = Index; LvItm.iSubItem = ColumnLoop; switch (ColumnLoop % 4) { case 0: LvItm.mask = LVIF_TEXT; LvItm.iImage = 0; LvItm.pszText = L""; ListView_InsertItem(ListWndHndl, &LvItm); ListView_SetCheckState(ListWndHndl, Index, true); break; case 1: LvItm.mask = LVIF_TEXT; LvItm.pszText = Na; ListView_SetItem(ListWndHndl, &LvItm); break; case 2: LvItm.mask = LVIF_TEXT; LvItm.pszText = De; ListView_SetItem(ListWndHndl, &LvItm); break; } ReplaceStatus(Index); } }
void LoadDictionary(HWND hwnd) { APPDATAXMLLIST list; LVITEMW item; HRESULT hr = ReadList(pathconfigxml, SectionDictionary, list); if(hr == S_OK && list.size() != 0) { HWND hWndListView = GetDlgItem(hwnd, IDC_LIST_SKK_DIC); int i = 0; FORWARD_ITERATION_I(l_itr, list) { if(l_itr->size() == 0 || (*l_itr)[0].first != AttributePath) { continue; } item.mask = LVIF_TEXT; item.pszText = (LPWSTR)(*l_itr)[0].second.c_str(); item.iItem = i; item.iSubItem = 0; ListView_InsertItem(hWndListView, &item); BOOL check = TRUE; if(l_itr->size() >= 2 && (*l_itr)[1].first == AttributeEnabled) { check = _wtoi((*l_itr)[1].second.c_str()); } ListView_SetCheckState(hWndListView, i, check); i++; } ListView_SetColumnWidth(hWndListView, 0, LVSCW_AUTOSIZE); }
void InitListViewContorol(HWND hWnd) { HWND hWndLV = GetDlgItem(hWnd, IDC_LIST_MAILBOX); LV_COLUMN lc; LV_ITEM li; HIMAGELIST hImgList; RECT rect; GetClientRect(hWndLV, &rect); // イメージリストの作成 hImgList = ImageList_Create(16, 16, ILC_COLOR | ILC_MASK, 1 , 1); ImageList_AddIcon(hImgList, LoadIcon(g_hInstance, "IDI_MAILBOX")); ListView_SetImageList(hWndLV, hImgList, LVSIL_SMALL); ListView_SetExtendedListViewStyle(hWndLV, LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES); // ヘッダを追加 (表示しない) lc.mask = LVCF_FMT | LVCF_SUBITEM | LVCF_TEXT | LVCF_WIDTH; lc.fmt = LVCFMT_LEFT; lc.pszText = "メールボックス"; lc.cx = rect.right; lc.iSubItem = 0; lc.cchTextMax = strlen(lc.pszText); ListView_InsertColumn(hWndLV, 0, &lc); lc.pszText = "フォルダ名"; lc.cx = 0; lc.iSubItem = 1; lc.cchTextMax = strlen(lc.pszText); ListView_InsertColumn(hWndLV, 1, &lc); // メールボックスを列挙 THash MailBoxes; EnumMailBox(MailBoxes); // メールボックスを追加 int i = 0; for (THash::iterator itr = MailBoxes.begin(); itr != MailBoxes.end(); ++itr) { li.mask = LVIF_TEXT | LVIF_IMAGE; li.iItem = i; li.iImage = 0; // 表示名 li.pszText = (char *)((*itr).second).c_str(); li.iSubItem = 0; ListView_InsertItem(hWndLV, &li); // メールボックスのディレクトリ名 li.pszText = (char *)((*itr).first).c_str(); li.iSubItem = 1; ListView_SetItem(hWndLV, &li); // 設定されているメールボックスにチェックをつける if (g_temporary_mailbox.count((*itr).first) == 1) { ListView_SetCheckState(hWndLV, i, 1); } i++; } }
void PopulateRulesList(HWND hWndList, int nSelected) { int i; LV_ITEM lvI; lvI.mask = LVIF_TEXT; lvI.iSubItem = 0; lvI.cchTextMax = 255; ListView_DeleteAllItems(hWndList); for(i = 0; i < 256; i++) { if (rule_text[i].rule[0] == '\0') break; i = ListView_GetItemCount(hWndList); lvI.iItem = i; lvI.pszText = rule_text[i].rule; ListView_InsertItem(hWndList, &lvI); if (rule_text[i].bEnabled) ListView_SetCheckState(hWndList, i, TRUE); if (i == nSelected) ListView_SetItemState(hWndList, i, LVIS_SELECTED, LVIS_SELECTED); } }
void CSysLogQuery::CheckAllItems(BOOL fChecked) { for(int nItem = 0;nItem < ListView_GetItemCount(m_Syslog_query);nItem++) { ListView_SetCheckState(m_Syslog_query,nItem,fChecked); } }
void TOSDpageDec::osd2dlg(void) { const char_t *osdsStr = cfgGetStr(IDFF_OSDformat); if (strncmp(osdsStr, _l("user"), 4) == 0) { ListView_SetExtendedListViewStyleEx(hlv, LVS_EX_CHECKBOXES, 0); setCheck(IDC_CHB_OSD_USER, 1); enable(1, IDC_ED_OSD_USER); setText(IDC_ED_OSD_USER, _l("%s"), osdsStr + 4); user = true; } else { ListView_SetExtendedListViewStyleEx(hlv, LVS_EX_CHECKBOXES, LVS_EX_CHECKBOXES); setCheck(IDC_CHB_OSD_USER, 0); enable(0, IDC_ED_OSD_USER); strtok(osdsStr, _l(" "), osds); int cnt = ListView_GetItemCount(hlv); nostate = true; for (int j = 0; j < cnt; j++) { ListView_SetCheckState(hlv, j, FALSE); } nostate = false; for (ints::const_iterator i = osds.begin(); i != osds.end(); i++) { checkOSDline(*i, true); } ListView_SortItems(hlv, osdsSort, LPARAM(this)); user = false; } int isAutoHide = cfgGet(IDFF_OSDisAutoHide); setCheck(IDC_CHB_OSD_IS_AUTO_HIDE, isAutoHide); enable(isAutoHide, IDC_ED_OSD_DURATION_VISIBLE); SetDlgItemInt(m_hwnd, IDC_ED_OSD_DURATION_VISIBLE, cfgGet(IDFF_OSDdurationVisible), FALSE); save2dlg(); }
void UpdateList(HWND hwndList) { LVITEM lvI = { 0 }; // Some code to create the list-view control. // Initialize LVITEM members that are common to all // items. int i = 0; for (MCONTACT hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) { UpdateListFlag = TRUE; lvI.mask = LVIF_TEXT; lvI.iSubItem = 0; TCHAR *ptszNick = db_get_tsa(hContact, MODULE, "Nick"); if (ptszNick) { lvI.pszText = ptszNick; lvI.iItem = i; ListView_InsertItem(hwndList, &lvI); lvI.iSubItem = 1; TCHAR *ptszURL = db_get_tsa(hContact, MODULE, "URL"); if (ptszURL) { lvI.pszText = ptszURL; ListView_SetItem(hwndList, &lvI); i++; ListView_SetCheckState(hwndList, lvI.iItem, db_get_b(hContact, MODULE, "CheckState", 1)); mir_free(ptszURL); } mir_free(ptszNick); } } UpdateListFlag = FALSE; }
DWORD WINAPI Watch( void *p) { TDATA *pData = (TDATA*)p; DWORD pid = pData->pid; // process의 ID //------------------------------ HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, 0, pid); if( hProcess == 0 ) { MessageBox(0, "프로세스의 핸들을 얻을 수 없다.", "", MB_OK); return 0; } ListView_SetCheckState(hMainList, pData->idx, TRUE); //----- Event 관련 구현 추가 --------------------------------- HANDLE hEvent = CreateEvent(0, TRUE, 0, "Exit"); //-> Open.(동일한 객체의 핸들) HANDLE h[2] = { hProcess, hEvent }; char temp[50]; DWORD ret = WaitForMultipleObjects( 2, h, FALSE, INFINITE); // 부분 시그널 if( ret == WAIT_OBJECT_0) // 프로세스가 시그널 { wsprintf(temp, "[ %s ] 프로세스가 종료하였습니다.", pData->exename); SetWindowText(hStaticLog, temp); Sleep(1000); } CloseHandle( hEvent); CloseHandle(hProcess); delete pData; ProcessList(); return 0; }
void AddDataBp(HWND hwnd) { char *name = (char *)DialogBoxParam(hInstance, "ADDDATABPDIALOG", hwnd, (DLGPROC)DataBpAddProc, 0); if (name) { DATABREAK **search = &dataBpList; DATABREAK *b = calloc(1, sizeof(DATABREAK)); int v; HWND hwndLV = GetDlgItem(hwnd, IDC_BPLIST); LV_ITEM item; int i = ListView_GetItemCount(hwndLV); memset(&item, 0, sizeof(item)); strcpy(b->name, name); while (*search) search = &(*search)->next; b->active = TRUE; *search = b; item.iItem = 10000; item.iSubItem = 0; item.mask = LVIF_PARAM; item.lParam = (LPARAM)b; v = ListView_InsertItem(hwndLV, &item); ListView_SetCheckState(hwndLV, v, TRUE); ListView_SetSelectionMark(hwndLV, i); ListView_SetItemState(hwndLV, i, LVIS_SELECTED, LVIS_SELECTED); } }
// ==> autofire setting, added by regret static int InpdAutofireInit() { if (!hInpdList || !hInpdDlg) { return 1; } // init autofire checkboxes AutoFireInfo* autofireInfo = NULL; map<int, AutoFireInfo>::iterator iter = autofireMap.begin(); for (; iter != autofireMap.end(); iter++) { autofireInfo = &iter->second; if (getAutofire(autofireInfo->player, autofireInfo->button)) { ListView_SetCheckState(hInpdList, iter->first, TRUE); } } // autofire delay control TCHAR delayStr[32] = _T(""); for (unsigned int i = 1; i < 100; i++) { _stprintf(delayStr, _T("%d"), i); SendDlgItemMessage(hInpdDlg, IDC_INPD_AUTOFIRE_DELAY, CB_ADDSTRING, 0, (LPARAM)delayStr); } SendDlgItemMessage(hInpdDlg, IDC_INPD_AUTOFIRE_DELAY, CB_SETCURSEL, (WPARAM)(autofireDelay - 1), 0); return 0; }
int ListView_MoveItem(HWND hwnd , int pos , int newPos) { char buff [2000]; int cols = Header_GetItemCount(ListView_GetHeader(hwnd)); LVITEM lvi; lvi.mask = LVIF_IMAGE|LVIF_INDENT|LVIF_PARAM|LVIF_TEXT|LVIF_STATE; lvi.iItem = pos; lvi.iSubItem = 0; lvi.stateMask= (UINT)-1; lvi.pszText = buff; lvi.cchTextMax = 2000; ListView_GetItem(hwnd , &lvi); int check = ListView_GetCheckState(hwnd , pos); if (newPos>pos) newPos++; else pos++; lvi.iItem = newPos; newPos = ListView_InsertItem(hwnd , &lvi); ListView_SetCheckState(hwnd , newPos , check); lvi.mask = LVIF_TEXT; for (int i=1; i<cols; i++) { lvi.iSubItem=i; lvi.iItem=pos; ListView_GetItem(hwnd , &lvi); lvi.iItem=newPos; ListView_SetItem(hwnd , &lvi); } // ListView_SetSelectionMark(hwnd , newPos); ListView_EnsureVisible(hwnd , newPos , 0); ListView_DeleteItem(hwnd , pos); return 1; }
// draw listview control and sort according to m_sort_type // void CDlgNetlist::DrawListCtrl() { int nItem; CString str; DWORD old_style = m_list_ctrl.GetExtendedStyle(); m_list_ctrl.SetExtendedStyle( LVS_EX_FULLROWSELECT | LVS_EX_FLATSB | LVS_EX_CHECKBOXES | old_style ); m_list_ctrl.DeleteAllItems(); m_list_ctrl.InsertColumn( COL_VIS, "Vis", LVCFMT_LEFT, 25 ); m_list_ctrl.InsertColumn( COL_NAME, "Name", LVCFMT_LEFT, 140 ); m_list_ctrl.InsertColumn( COL_PINS, "Pins", LVCFMT_LEFT, 40 ); m_list_ctrl.InsertColumn( COL_WIDTH, "Width", LVCFMT_LEFT, 40 ); m_list_ctrl.InsertColumn( COL_VIA_W, "Via W", LVCFMT_LEFT, 40 ); m_list_ctrl.InsertColumn( COL_HOLE_W, "Hole", LVCFMT_LEFT, 40 ); int iItem = 0; for( int i=0; i<::nl.GetSize(); i++ ) { if( ::nl[i].deleted == FALSE ) { nItem = m_list_ctrl.InsertItem( iItem, "" ); m_list_ctrl.SetItemData( iItem, (LPARAM)i ); m_list_ctrl.SetItem( iItem, COL_NAME, LVIF_TEXT, ::nl[i].name, 0, 0, 0, 0 ); str.Format( "%d", ::nl[i].ref_des.GetSize() ); m_list_ctrl.SetItem( iItem, COL_PINS, LVIF_TEXT, str, 0, 0, 0, 0 ); str.Format( "%d", ::nl[i].w/NM_PER_MIL ); m_list_ctrl.SetItem( iItem, COL_WIDTH, LVIF_TEXT, str, 0, 0, 0, 0 ); str.Format( "%d", ::nl[i].v_w/NM_PER_MIL ); m_list_ctrl.SetItem( iItem, COL_VIA_W, LVIF_TEXT, str, 0, 0, 0, 0 ); str.Format( "%d", ::nl[i].v_h_w/NM_PER_MIL ); m_list_ctrl.SetItem( iItem, COL_HOLE_W, LVIF_TEXT, str, 0, 0, 0, 0 ); ListView_SetCheckState( m_list_ctrl, nItem, ::nl[i].visible ); } } m_list_ctrl.SortItems( ::CompareNetlist, m_sort_type ); }
BOOL CDlgPluginSetup::OnInitDialog() { CDialog::OnInitDialog(); // TODO: この位置に初期化の補足処理を追加してください DWORD dwStyle; dwStyle = m_listPlugin.SendMessage(LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0); dwStyle |= LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT; m_listPlugin.SendMessage(LVM_SETEXTENDEDLISTVIEWSTYLE, 0, dwStyle); RECT rect; m_listPlugin.GetClientRect(&rect); m_listPlugin.InsertColumn(1, L"プラグイン", LVCFMT_LEFT, rect.right-rect.left-16, -1); m_listPlugin.DeleteAllItems(); // クリア for (int nIndex=0;nIndex<plugins.arPlugins.GetSize();nIndex++) { PSTEPlugin pPlugin = (PSTEPlugin)plugins.arPlugins.GetAt(nIndex); m_listPlugin.InsertItem(nIndex, pPlugin->sPluginName); m_listPlugin.SetItemData(nIndex, (DWORD)pPlugin); ListView_SetCheckState(m_listPlugin.GetSafeHwnd(), nIndex, pPlugin->bUse ? TRUE : FALSE); } return TRUE; // コントロールにフォーカスを設定しないとき、戻り値は TRUE となります // 例外: OCX プロパティ ページの戻り値は FALSE となります }
HRESULT CLAVVideoFormatsProp::OnActivate() { HRESULT hr = S_OK; INITCOMMONCONTROLSEX icc; icc.dwSize = sizeof(INITCOMMONCONTROLSEX); icc.dwICC = ICC_BAR_CLASSES | ICC_STANDARD_CLASSES | ICC_LISTVIEW_CLASSES; if (InitCommonControlsEx(&icc) == FALSE) { return E_FAIL; } ASSERT(m_pVideoSettings != NULL); // Setup ListView control for format configuration HWND hlv = GetDlgItem(m_Dlg, IDC_CODECS); ListView_SetExtendedListViewStyle(hlv, LVS_EX_CHECKBOXES|LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES); int nCol = 1; LVCOLUMN lvc = {LVCF_WIDTH, 0, 20, 0}; ListView_InsertColumn(hlv, 0, &lvc); ListView_AddCol(hlv, nCol, 85, L"Codec", false); ListView_AddCol(hlv, nCol, 400, L"Description", false); ListView_DeleteAllItems(hlv); ListView_SetItemCount(hlv, Codec_VideoNB); // Create entries for the formats LVITEM lvi; memset(&lvi, 0, sizeof(lvi)); lvi.mask = LVIF_TEXT|LVIF_PARAM; int nItem = 0; for (nItem = 0; nItem < Codec_VideoNB; ++nItem) { const codec_config_t *config = get_codec_config((LAVVideoCodec)nItem); // Create main entry lvi.iItem = nItem + 1; ListView_InsertItem(hlv, &lvi); // Set sub item texts ATL::CA2W name(config->name); ListView_SetItemText(hlv, nItem, 1, (LPWSTR)name); ATL::CA2W desc(config->description); ListView_SetItemText(hlv, nItem, 2, (LPWSTR)desc); } hr = LoadData(); if (SUCCEEDED(hr)) { // Set checked state for (nItem = 0; nItem < ListView_GetItemCount(hlv); nItem++) { ListView_SetCheckState(hlv, nItem, m_bFormats[nItem]); } } SendDlgItemMessage(m_Dlg, IDC_CODECS_MSWMVDMO, BM_SETCHECK, m_bWMVDMO, 0); SendDlgItemMessage(m_Dlg, IDC_DVD_VIDEO, BM_SETCHECK, m_bDVD, 0); return hr; }
void mm_mod_list_cancel_mod_install(mm_mod_item *mod_item, int listIndex) { // alright hide the mod file list window thing mm_hide_mod_install_files(); // update the checkbox state so that it goes back to the mod enabled state ListView_SetCheckState(mm_mod_list, listIndex, mod_item->enabled); }
VOID AddNetworkAdapterToListView( _In_ PDV_NETADAPTER_CONTEXT Context, _In_ BOOLEAN AdapterPresent, _In_ IF_INDEX IfIndex, _In_ IF_LUID Luid, _In_ PPH_STRING Guid, _In_ PPH_STRING Description ) { DV_NETADAPTER_ID adapterId; INT lvItemIndex; BOOLEAN found = FALSE; PDV_NETADAPTER_ID newId = NULL; InitializeNetAdapterId(&adapterId, IfIndex, Luid, Guid); for (ULONG i = 0; i < NetworkAdaptersList->Count; i++) { PDV_NETADAPTER_ENTRY entry = PhReferenceObjectSafe(NetworkAdaptersList->Items[i]); if (!entry) continue; if (EquivalentNetAdapterId(&entry->AdapterId, &adapterId)) { newId = PhAllocate(sizeof(DV_NETADAPTER_ID)); CopyNetAdapterId(newId, &entry->AdapterId); if (entry->UserReference) found = TRUE; } PhDereferenceObjectDeferDelete(entry); if (newId) break; } if (!newId) { newId = PhAllocate(sizeof(DV_NETADAPTER_ID)); CopyNetAdapterId(newId, &adapterId); PhMoveReference(&newId->InterfaceGuid, Guid); } lvItemIndex = PhAddListViewGroupItem( Context->ListViewHandle, AdapterPresent ? 0 : 1, MAXINT, Description->Buffer, newId ); if (found) ListView_SetCheckState(Context->ListViewHandle, lvItemIndex, TRUE); DeleteNetAdapterId(&adapterId); }
static void PopulateExToolsView(HWND hwnd, int sel, BOOL first) { TOOL *curTools = tools; int items = 0; int i; LV_ITEM item; RECT r; HWND hwndLV = GetDlgItem(hwnd, IDC_EXTOOLCUSTOM); if (first) { LV_COLUMN lvC; ListView_SetExtendedListViewStyle(hwndLV, LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT); GetWindowRect(hwndLV, &r); lvC.mask = LVCF_WIDTH | LVCF_SUBITEM ; lvC.cx = 20; lvC.iSubItem = 0; ListView_InsertColumn(hwndLV, 0, &lvC); lvC.mask = LVCF_WIDTH | LVCF_SUBITEM; lvC.cx = 32; lvC.iSubItem = 1; ListView_InsertColumn(hwndLV, 1, &lvC); lvC.mask = LVCF_FMT | LVCF_WIDTH | LVCF_SUBITEM; lvC.fmt = LVCFMT_LEFT; lvC.cx = r.right - r.left - 56; lvC.iSubItem = 2; ListView_InsertColumn(hwndLV, 2, &lvC); } else { ListView_DeleteAllItems(hwndLV); } start = TRUE; for (i=0; curTools; curTools = curTools->next, i++) { if (!curTools->removing) { int v; item.iItem = items++; item.iSubItem = 0; item.mask = LVIF_PARAM ; item.lParam = (LPARAM)i; item.pszText = ""; // LPSTR_TEXTCALLBACK ; v = ListView_InsertItem(hwndLV, &item); ListView_SetCheckState(hwndLV, v, curTools->enabled ? 1 : 0); } } start = FALSE; if (items) { ListView_SetSelectionMark(hwndLV, sel); ListView_SetItemState(hwndLV, sel, LVIS_SELECTED, LVIS_SELECTED); } }
static void SelectAll(HWND hDlg, bool bEnable) { OBJLIST<FILEINFO> &todo = *(OBJLIST<FILEINFO> *)GetWindowLongPtr(hDlg, GWLP_USERDATA); HWND hwndList = GetDlgItem(hDlg, IDC_LIST_UPDATES); for (int i=0; i < todo.getCount(); i++) { ListView_SetCheckState(hwndList, i, todo[i].bEnabled = bEnable); } }
bool CListView::CheckItem(int Index,bool fCheck) { if (m_hwnd==nullptr) return false; ListView_SetCheckState(m_hwnd,Index,fCheck); return true; }
static void SelectAll(HWND hDlg, bool bEnable) { OBJLIST<FILEINFO> &todo = *(OBJLIST<FILEINFO> *)GetWindowLongPtr(hDlg, GWLP_USERDATA); HWND hwndList = GetDlgItem(hDlg, IDC_LIST_UPDATES); for (int i=0; i < todo.getCount(); i++) { ListView_SetCheckState(hwndList, i, bEnable); db_set_b(NULL, DB_MODULE_FILES, StrToLower(_T2A(todo[i].tszOldName)), todo[i].bEnabled = bEnable); } }
void CSubtitleUpDlg::DownloadSelectedSubtitles() { POSITION pos = m_list.GetFirstSelectedItemPosition(); while (pos) { int nItem = m_list.GetNextSelectedItem(pos); if (nItem >= 0 && nItem < m_list.GetItemCount()) { ListView_SetCheckState(m_list.GetSafeHwnd(), nItem, TRUE); } } //OnOK(); }
void CDlgNetlist::OnBnClickedButtonVisible() { for( int i=0; i<m_list_ctrl.GetItemCount(); i++ ) { ListView_SetCheckState( m_list_ctrl, i, m_visible_state ); } for( int i=0; i<::nl.GetSize(); i++ ) { ::nl[i].visible = m_visible_state; } m_visible_state = 1 - m_visible_state; }
void CDlgPluginSetup::OnBtDown() { // TODO: この位置にコントロール通知ハンドラ用のコードを追加してください int nIndex = ListView_GetSelectedItem(m_listPlugin); PSTEPlugin pPlugin = (PSTEPlugin)m_listPlugin.GetItemData(nIndex); nIndex += 2; m_listPlugin.InsertItem(nIndex, pPlugin->sPluginName); m_listPlugin.SetItemData(nIndex, (DWORD)pPlugin); ListView_SetCheckState(m_listPlugin.GetSafeHwnd(), nIndex, pPlugin->bUse ? TRUE : FALSE); m_listPlugin.DeleteItem(nIndex-2); m_listPlugin.SetItemState(nIndex-1, LVIS_FOCUSED | LVIS_SELECTED, LVIS_FOCUSED | LVIS_SELECTED); }
void TOSDpageDec::checkOSDline(int idff, bool check) { nostate = true; LVFINDINFO lvfi; memset(&lvfi, 0, sizeof(lvfi)); lvfi.flags = LVFI_PARAM; lvfi.lParam = idff; int i = ListView_FindItem(hlv, -1, &lvfi); if (i != -1) { ListView_SetCheckState(hlv, i, check); } nostate = false; }
VOID AddItemToListView(HWND hDlgCtrl, PNET_ITEM pItem, LPWSTR szName, BOOL bChecked) { LVITEMW lvItem; ZeroMemory(&lvItem, sizeof(lvItem)); lvItem.mask = LVIF_TEXT | LVIF_PARAM; lvItem.pszText = szName; lvItem.lParam = (LPARAM)pItem; lvItem.iItem = ListView_GetItemCount(hDlgCtrl); lvItem.iItem = SendMessageW(hDlgCtrl, LVM_INSERTITEMW, 0, (LPARAM)&lvItem); ListView_SetCheckState(hDlgCtrl, lvItem.iItem, bChecked); }