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); }
// Start the specified threads // [in] AllThreads : If you start all threads, true is to be passed. Otherwize false is passed. // [out] Result Code int StkThreadGuiManager::StartThreads(bool AllThreads) { if (DlgWndHndl != NULL) { SetFocus(DlgWndHndl); // TABフォーカスが失われるのを防止する施策 //Disable Start and Stop button. EnableWindow(GetDlgItem(DlgWndHndl, IDC_START), false); EnableWindow(GetDlgItem(DlgWndHndl, IDC_STOP), false); } // Change the status on GUI. for (int RowLoop = 0; RowLoop < GetNumOfStkThread(); RowLoop++) { if (AllThreads == true || ListView_GetCheckState(ListWndHndl, RowLoop) == TRUE) { if (GetStkThreadStatusByIndex(RowLoop) != STKTHREAD_STATUS_RUNNING) { ReplaceStatus(RowLoop, STKTHREAD_STATUS_STARTING); } } } // Does selected thread IDs are stored into Ids[] variable. int Ids[MAX_NUM_OF_THREADS]; int IdsIndex = 0; for (int RowLoop = 0; RowLoop < GetNumOfStkThread(); RowLoop++) { if ((AllThreads == true || ListView_GetCheckState(ListWndHndl, RowLoop) == TRUE) && GetStkThreadStatusByIndex(RowLoop) == STKTHREAD_STATUS_READY) { Ids[IdsIndex] = GetStkThreadIdByIndex(RowLoop); IdsIndex++; } } // Start selected threads. StartSpecifiedStkThreads(Ids, IdsIndex); // When AllThreads is true, check whether all threads are running or not. // If some threads are not running, wait for the status change. while (AllThreads) { bool AllRunning = true; for (int RowLoop = 0; RowLoop < GetNumOfStkThread(); RowLoop++) { if (GetStkThreadStatusByIndex(RowLoop) != STKTHREAD_STATUS_RUNNING) { AllRunning = false; break; } } if (AllRunning == true) { break; } else { Sleep(100); } } RefreshLog(false); return 0; }
void GeneralPage::savePage() { // option: auto-start server on startup SettingsManager::getInstance()->setBool(SettingsManager::AUTOSTART,ListView_GetCheckState(m_hListOptions,0)); // option: automatically check for updates SettingsManager::getInstance()->setBool(SettingsManager::CHECKFORUPDATES,ListView_GetCheckState(m_hListOptions,1)); // option: confirm on application exit SettingsManager::getInstance()->setBool(SettingsManager::CONFIRMEXIT,ListView_GetCheckState(m_hListOptions,2)); // option: minimize to tray SettingsManager::getInstance()->setBool(SettingsManager::MINIMIZETOTRAY,ListView_GetCheckState(m_hListOptions,3)); }
void UserSetupPage::savePage(User *pUser) { char sz[255]; memset(sz,0,sizeof(sz)); GetWindowText(m_hEditName,sz,sizeof(sz)); pUser->setName(sz); if ( !m_newPassword.empty() ) { pUser->setPassword(m_newPassword.c_str()); } pUser->setDisabled(Button_GetCheck(m_hCheckDisabled)); std::list<std::string> groupGuids; int groupsCount = ListView_GetItemCount(m_hListGroups); for ( int i=0; i<groupsCount; i++ ) { if ( ListView_GetCheckState(m_hListGroups,i) ) { Group *pGroup = (Group*)WinUtil::ListViewUtil::getItemParam(m_hListGroups,i); groupGuids.push_back(pGroup->getGuid()); } } pUser->setGroups(groupGuids); }
INT_PTR CLAVVideoFormatsProp::OnReceiveMessage(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_COMMAND: if (LOWORD(wParam) == IDC_CODECS_MSWMVDMO && HIWORD(wParam) == BN_CLICKED) { BOOL bValue = (BOOL)SendDlgItemMessage(m_Dlg, LOWORD(wParam), BM_GETCHECK, 0, 0); if (bValue != m_bWMVDMO) { SetDirty(); } } else if (LOWORD(wParam) == IDC_DVD_VIDEO && HIWORD(wParam) == BN_CLICKED) { BOOL bValue = (BOOL)SendDlgItemMessage(m_Dlg, LOWORD(wParam), BM_GETCHECK, 0, 0); if (bValue != m_bDVD) { SetDirty(); } } break; case WM_NOTIFY: NMHDR *hdr = (LPNMHDR)lParam; if (hdr->idFrom == IDC_CODECS) { switch (hdr->code) { case LVN_ITEMCHANGED: LPNMLISTVIEW nmlv = (LPNMLISTVIEW)lParam; BOOL check = ListView_GetCheckState(hdr->hwndFrom, nmlv->iItem); if (check != m_bFormats[nmlv->iItem]) { SetDirty(); } return TRUE; } } break; } // Let the parent class handle the message. return __super::OnReceiveMessage(hwnd, uMsg, wParam, lParam); }
void OBS::CheckSources() { XElement *curSceneElement = App->sceneElement; XElement *sources = curSceneElement->GetElement(TEXT("sources")); if(!sources) return; HWND hwndSources = GetDlgItem(hwndMain, ID_SOURCES); UINT numSources = ListView_GetItemCount(hwndSources); for(UINT i = 0; i < numSources; i++) { bool checked = ListView_GetCheckState(hwndSources, i) > 0; XElement *source =sources->GetElementByID(i); bool curRender = source->GetInt(TEXT("render"), 0) > 0; if(curRender != checked) { source->SetInt(TEXT("render"), (checked)?1:0); if(scene && i < scene->NumSceneItems()) { SceneItem *sceneItem = scene->GetSceneItem(i); sceneItem->bRender = checked; sceneItem->SetRender(checked); } ReportSourceChanged(source->GetName(), source); } } }
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; }
bool wxCheckListBox::IsChecked(unsigned int uiIndex) const { wxCHECK_MSG( IsValid( uiIndex ), false, wxT("invalid index in wxCheckListBox::IsChecked") ); return (ListView_GetCheckState(((HWND)GetHWND()), uiIndex) != 0); }
bool CListView::IsItemChecked(int Index) const { if (m_hwnd==nullptr) return false; return ListView_GetCheckState(m_hwnd,Index)!=FALSE; }
void CSysLogQuery::SetHeaderCheckbox(void) { BOOL fChecked = TRUE; for(int nItem = 0;nItem < ListView_GetItemCount(m_Syslog_query);nItem++) { if(!ListView_GetCheckState(m_Syslog_query,nItem)) { fChecked = FALSE; break; } } HWND header = ListView_GetHeader(m_Syslog_query); HDITEM hdi = {0}; hdi.mask = HDI_FORMAT; Header_GetItem(header,0,&hdi); if (fChecked) { hdi.fmt |= HDF_CHECKED; } else { hdi.fmt &= ~HDF_CHECKED; } Header_SetItem(header, 0, &hdi); }
void CDlgNetlist::OnBnClickedButtonEdit() { int n_sel = m_list_ctrl.GetSelectedCount(); if( n_sel == 0 ) AfxMessageBox( "You have no net selected" ); else if( n_sel > 1 ) AfxMessageBox( "You have more than one net selected" ); else { POSITION pos = m_list_ctrl.GetFirstSelectedItemPosition(); if( pos == NULL ) ASSERT(0); int nItem = m_list_ctrl.GetNextSelectedItem(pos); int i = m_list_ctrl.GetItemData( nItem ); // prepare and invoke dialog CFreePcbView * view = theApp.m_View; CFreePcbDoc * doc = theApp.m_Doc; CDlgEditNet dlg; dlg.Initialize( doc->m_nlist, &nl, i, m_plist, FALSE, ListView_GetCheckState( m_list_ctrl, nItem ), MIL, &(doc->m_w), &(doc->m_v_w), &(doc->m_v_h_w) ); int ret = dlg.DoModal(); if( ret == IDOK ) { // implement edits into nl and update m_list_ctrl DrawListCtrl(); } } }
void CContainer::OnColumnDlgOk(HWND hDlg) { HWND hListView; LVITEM lvItem; list<Column_t> ColumnTempList; Column_t Column; int i = 0; hListView = GetDlgItem(hDlg,IDC_COLUMNS_LISTVIEW); for(i = 0; i < ListView_GetItemCount(hListView); i++) { lvItem.mask = LVIF_PARAM; lvItem.iItem = i; lvItem.iSubItem = 0; ListView_GetItem(hListView,&lvItem); Column.id = (int)lvItem.lParam; Column.bChecked = ListView_GetCheckState(hListView,i); Column.iWidth = DEFAULT_COLUMN_WIDTH; ColumnTempList.push_back(Column); } m_pActiveShellBrowser->ImportColumns(&ColumnTempList,g_bColumnsSwapped); if(g_bColumnsSwapped) RefreshTab(m_iObjectIndex); SelectColumnsSaveState(hDlg); EndDialog(hDlg,1); }
BOOL OnSetupOK(HWND hWnd) { // リストビューを走査 HWND hWndLV = GetDlgItem(hWnd, IDC_LIST_MAILBOX); int iCount = ListView_GetItemCount(hWndLV); char szName[13]; // チェックボックスにチェックが無いものは,メールボックスから削除 for (int i = 0; i < iCount; ++i) { if (!ListView_GetCheckState(hWndLV, i)) { ListView_GetItemText(hWndLV, i, 1, szName, sizeof(szName)); g_temporary_mailbox.erase(szName); } } // ini ファイルの MailBoxes セクションをクリア WritePrivateProfileString("MailBoxes", NULL, NULL, szIni); common::array array; for (TMailBox::iterator mailbox = g_temporary_mailbox.begin(); mailbox != g_temporary_mailbox.end(); ++mailbox) { // ini ファイルに書き込み WritePrivateProfileString("MailBoxes", ((*mailbox).first).c_str(), (array.join((*mailbox).second, ",")).c_str(), szIni); } // メールボックスをコピー g_mailbox = g_temporary_mailbox; return true; }
void CMainFrame::OnLvnItemchangedListGislayer(NMHDR *pNMHDR, LRESULT *pResult) { LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR); // TODO: Add your control notification handler code here *pResult = 0; CListCtrl * pGISLayerList = (CListCtrl *)m_GISLayerBar.GetDlgItem(IDC_LIST_GISLAYER); // determine which layer is active POSITION pos = pGISLayerList->GetFirstSelectedItemPosition(); if (pos != NULL) { int nItem = pGISLayerList->GetNextSelectedItem(pos); m_iSelectedLayer = (layer_mode) nItem; BOOL bChecked = pGISLayerList->GetCheck(nItem); m_bShowLayerMap[m_iSelectedLayer] = bChecked; } // detemine the selection status if(bLayerInitialized) { for(int nItem =0 ; nItem < pGISLayerList->GetItemCount(); nItem++) { BOOL bChecked = ListView_GetCheckState(pGISLayerList->m_hWnd,nItem); m_bShowLayerMap[(layer_mode) nItem] = bChecked; } } pGISLayerList->Invalidate (1); UpdateAllViews(); }
BOOL AP_Win32Dialog_CollaborationAccounts::_onNotify(HWND hWnd, WPARAM wParam, LPARAM lParam) { LPNMHDR nmhdr = (LPNMHDR)lParam; UT_return_val_if_fail(nmhdr, false); switch (nmhdr->code) { case LVN_ITEMCHANGED: // Not sure if LVN_ITEMCHANGED is the best place to check the selection state, // but I can't find a "selection changed" signal and this works... if (!m_bPopulating && wParam == AP_RID_DIALOG_COLLABORATIONACCOUNTS_ACCOUNT_LIST) { _updateSelection(); LPNMLISTVIEW item = (LPNMLISTVIEW)lParam; UT_return_val_if_fail(item->iItem >= 0, false); UT_return_val_if_fail(item->lParam, false); AccountHandler* pAccount = reinterpret_cast<AccountHandler*>(item->lParam); bool isChecked = ListView_GetCheckState(m_hAccountList, item->iItem); _setOnline(pAccount, isChecked); return true; } return false; default: return false; } }
void DialogInstall::BeginInstall() { HWND item = GetDlgItem(m_Window, IDC_INSTALL_ADVANCED_BUTTON); EnableWindow(item, FALSE); item = GetDlgItem(m_Window, IDC_INSTALL_INSTALL_BUTTON); EnableWindow(item, FALSE); item = GetDlgItem(m_Window, IDCANCEL); EnableWindow(item, FALSE); item = GetDlgItem(m_TabInstall.GetWindow(), IDC_INSTALLTAB_THEME_CHECKBOX); if (Button_GetCheck(item) == BST_UNCHECKED) { m_LoadLayout.clear(); m_LoadSkins.clear(); } EnableWindow(item, FALSE); item = GetDlgItem(m_TabInstall.GetWindow(), IDC_INSTALLTAB_COMPONENTS_LIST); { // Remove unchecked items from the component sets LVITEM lvi; lvi.mask = LVIF_GROUPID | LVIF_PARAM; lvi.iSubItem = 0; lvi.iItem = 0; int itemCount = ListView_GetItemCount(item); for (; lvi.iItem < itemCount; ++lvi.iItem) { ListView_GetItem(item, &lvi); std::set<std::wstring>* component = nullptr; switch (lvi.iGroupId) { case 0: component = &m_PackageSkins; break; case 1: component = &m_PackageLayouts; break; case 2: component = &m_PackageAddons; break; case 3: component = &m_PackagePlugins; break; } BOOL checked = ListView_GetCheckState(item, lvi.iItem); if (component && !checked) { component->erase(*(std::wstring*)lvi.lParam); } } } EnableWindow(item, FALSE); m_InstallThread = (HANDLE)_beginthreadex(nullptr, 0, InstallThread, this, 0, nullptr); if (!m_InstallThread) { MessageBox(m_Window, L"Unable to start install.", L"Rainmeter Skin Installer", MB_ERROR); EndDialog(m_Window, 0); } }
BOOL CAddTracksDialog::OnCommand(int iControl) { int cTracks = ListView_GetItemCount(m_hwndTrackList); int iLastTrack = m_pModPlaylist->GetCount(); int iTrack; BOOL fHandled = TRUE; switch (iControl) { case ID_SELECT_ALL: for (iTrack = 0; iTrack <= cTracks; iTrack++) { ListView_SetItemState(m_hwndTrackList, iTrack, INDEXTOSTATEIMAGEMASK(m_bSelectedAll?1:2), LVIS_STATEIMAGEMASK); } m_bSelectedAll = !m_bSelectedAll; if (m_bSelectedAll) { SetDlgItemText(m_hwndDlg, ID_SELECT_ALL, L"Unselect All"); } else { SetDlgItemText(m_hwndDlg, ID_SELECT_ALL, L"Select All"); } break; case IDCANCEL: EndDialog(m_hwndDlg, iControl); break; case IDOK: for (iTrack = 0; iTrack < cTracks; iTrack++) { BOOL fChecked = ListView_GetCheckState(m_hwndTrackList, iTrack); if (NULL != m_pPlaylist && fChecked) { CMediaClip * pClip = m_pPlaylist->GetTrack(iTrack); if (NULL != pClip) { m_pModPlaylist->InsertTrack(++iLastTrack, pClip->GetPath()); m_pModPlaylist->IsCEPlaylist(true); } } } EndDialog(m_hwndDlg, iControl); break; } return fHandled; }
void CDlgProcessSequence::OnOK() { // assumes that the list here is the same as the list in the ctrl #ifndef hab15a7 updateCheckBoxes(); #else // hab15a7 for(int i=0; i< m_ppProcesses->GetSize() ; i++) (*m_ppProcesses)[i]->m_bEnabled = ListView_GetCheckState(m_processListCtrl.m_hWnd, i); #endif // hab15a7 CDialog::OnOK(); }
static void Update_Btn_States(HWND hDlg) { // HWND hTree = GetDlgItem(hDlg, IDC_SYSTEM_TREE); // // "Enable all" / "Disable all" buttons. // // UINT uRootCheckState = TreeView_GetRealSubtreeState(hTree, TVI_ROOT); UINT uRootCheckState = ListView_GetCheckState(hServicesListCtrl, 0); #define OP(a, b) ((a) == (b) ? (a) : 2) int index = 0; // -1 // From the beginning + 1. while ((index = ListView_GetNextItem(hServicesListCtrl, index, LVNI_ALL)) != -1) { UINT temp = ListView_GetCheckState(hServicesListCtrl, index); uRootCheckState = OP(uRootCheckState, temp); } if (uRootCheckState == 0) { EnableWindow(GetDlgItem(hDlg, IDC_BTN_SERVICES_ACTIVATE) , TRUE ); EnableWindow(GetDlgItem(hDlg, IDC_BTN_SERVICES_DEACTIVATE), FALSE); } else if (uRootCheckState == 1) { EnableWindow(GetDlgItem(hDlg, IDC_BTN_SERVICES_ACTIVATE) , FALSE); EnableWindow(GetDlgItem(hDlg, IDC_BTN_SERVICES_DEACTIVATE), TRUE ); } else if (uRootCheckState == 2) { EnableWindow(GetDlgItem(hDlg, IDC_BTN_SERVICES_ACTIVATE) , TRUE); EnableWindow(GetDlgItem(hDlg, IDC_BTN_SERVICES_DEACTIVATE), TRUE); } else { EnableWindow(GetDlgItem(hDlg, IDC_BTN_SERVICES_ACTIVATE) , FALSE); EnableWindow(GetDlgItem(hDlg, IDC_BTN_SERVICES_DEACTIVATE), FALSE); } return; }
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); } }
UINT ListView_GetCheckedCount(HWND hwnd) { int count, idx, checkedcount; count = ListView_GetItemCount(hwnd); for (idx = 0, checkedcount = 0; idx < count; idx ++) { if (ListView_GetCheckState(hwnd, idx)) { checkedcount ++; } } return checkedcount; }
void CSecondaryStructurePredictionDlg::OnBnClickedSetweight() { UpdateData(); for(int i = 0; i < myBrainList.GetItemCount(); i++) { if(ListView_GetCheckState(myBrainList.m_hWnd,i) ) { myWeights[i] = currentWeight; } } UpdateBrainControl(); }
void TOSDpageDec::lv2osdFormat(void) { char_t format[1024] = _l(""); int cnt = ListView_GetItemCount(hlv); for (int i = 0; i < cnt; i++) if (ListView_GetCheckState(hlv, i)) { strncatf(format, countof(format), _l("%i "), lvGetItemParam(IDC_LV_OSD_LINES, i)); } if (format[strlen(format) - 1] == ' ') { format[strlen(format) - 1] = '\0'; } cfgSet(IDFF_OSDformat, format); parent->setChange(); }
// Stop the specified threads // [in] AllThreads : If you stop all threads, true is to be passed. Otherwize false is passed. // [out] Result Code int StkThreadGuiManager::StopThreads(bool AllThreads) { if (DlgWndHndl != NULL) { SetFocus(DlgWndHndl); // TABフォーカスが失われるのを防止する施策 //Disable Start and Stop button. EnableWindow(GetDlgItem(DlgWndHndl, IDC_START), false); EnableWindow(GetDlgItem(DlgWndHndl, IDC_STOP), false); } // Change the status on GUI. for (int RowLoop = 0; RowLoop < GetNumOfStkThread(); RowLoop++) { if (AllThreads == true || ListView_GetCheckState(ListWndHndl, RowLoop) == TRUE) { if (GetStkThreadStatusByIndex(RowLoop) != STKTHREAD_STATUS_READY) { ReplaceStatus(RowLoop, STKTHREAD_STATUS_STOPPING); } } } // Does selected thread IDs are stored into Ids[] variable. int Ids[MAX_NUM_OF_THREADS]; int IdsIndex = 0; for (int RowLoop = 0; RowLoop < GetNumOfStkThread(); RowLoop++) { if ((AllThreads == true || ListView_GetCheckState(ListWndHndl, RowLoop) == TRUE) && GetStkThreadStatusByIndex(RowLoop) == STKTHREAD_STATUS_RUNNING) { Ids[IdsIndex] = GetStkThreadIdByIndex(RowLoop); IdsIndex++; } } // Stop selected threads. StopSpecifiedStkThreads(Ids, IdsIndex); RefreshLog(false); return 0; }
/*void CCaCertExtPage::OnKillfocusRichedit(NMHDR* pNMHDR, LRESULT* pResult) { // TODO: Add your control notification handler code here // AfxMessageBox("kill"); *pResult = 0; } void CCaCertExtPage::OnReturnRichedit(NMHDR* pNMHDR, LRESULT* pResult) { // TODO: Add your control notification handler code here // AfxMessageBox("enter"); *pResult = 0; } */ void CCaCertExtPage::GetCert(stuCERTEXT *& pCertExt) { int nCount = m_CheckList.GetItemCount(); CString strName,strInside; DWORD dData = 0; for(int i = 0; i<nCount; i++) { //检查状态 if(ListView_GetCheckState(m_CheckList.m_hWnd,i))//此项选中 { strName = m_CheckList.GetItemText(i,1); pCertExt->Add(pCertExt, m_ArrayInside[i], strName); } } }
// Set status of master check box // [in] Nothing // [out] Nothing void StkThreadGuiManager::SetStatusOfMasterCheckBox() { int CheckedCnt = 0; int RowLoop; for (RowLoop = 0; RowLoop < GetNumOfStkThread(); RowLoop++) { if (ListView_GetCheckState(ListWndHndl, RowLoop) == TRUE) { CheckedCnt++; } } if (CheckedCnt == 0) { CheckDlgButton(DlgWndHndl, IDC_ALLCHECK, BST_UNCHECKED); } else if (CheckedCnt == GetNumOfStkThread()) { CheckDlgButton(DlgWndHndl, IDC_ALLCHECK, BST_CHECKED); } else { CheckDlgButton(DlgWndHndl, IDC_ALLCHECK, BST_INDETERMINATE); } }
HRESULT CLAVAudioFormatsProp::OnApplyChanges() { ASSERT(m_pAudioSettings != nullptr); HRESULT hr = S_OK; HWND hlv = GetDlgItem(m_Dlg, IDC_CODECS); // Get checked state BOOL bFlag; for (int nItem = 0; nItem < ListView_GetItemCount(hlv); nItem++) { bFlag = ListView_GetCheckState(hlv, nItem); m_pAudioSettings->SetFormatConfiguration((LAVAudioCodec)nItem, bFlag); } LoadData(); return hr; }
HRESULT CLAVSplitterFormatsProp::OnApplyChanges() { HRESULT hr = S_OK; ASSERT(m_pLAVF != nullptr); HWND hlv = GetDlgItem(m_Dlg, IDC_FORMATS); int nItem = 0; std::set<FormatInfo>::const_iterator it; for (it = m_Formats.begin(); it != m_Formats.end(); ++it) { m_bFormats[nItem] = ListView_GetCheckState(hlv, nItem); m_pLAVF->SetFormatEnabled(it->strName, m_bFormats[nItem]); nItem++; } return hr; }
static void InpdAutofireExit() { if (!hInpdDlg) { return; } // autofire delay autofireDelay = SendDlgItemMessage(hInpdDlg, IDC_INPD_AUTOFIRE_DELAY, CB_GETCURSEL, 0, 0) + 1; // autofire state AutoFireInfo* autofireInfo = NULL; map<int, AutoFireInfo>::iterator iter = autofireMap.begin(); for (; iter != autofireMap.end(); iter++) { autofireInfo = &iter->second; BOOL state = ListView_GetCheckState(hInpdList, iter->first); setAutofire(autofireInfo->player, autofireInfo->button, state); } autofireMap.clear(); }
BOOL OnNotifyListView(HWND hWnd, WPARAM wParam, LPARAM lParam) { HWND hWndLV = GetDlgItem(hWnd, IDC_LIST_MAILBOX); LV_DISPINFO *lvinfo = (LV_DISPINFO *)lParam; LPNMLISTVIEW pnmlist = (LPNMLISTVIEW)lParam; // 選択されているインデックスを取得 int iItem = ListView_GetNextItem(hWndLV, -1, LVNI_ALL | LVNI_SELECTED); // チェックボックスの状態を取得 int lvChecked = ListView_GetCheckState(hWndLV, iItem); // アイテムの状態を取得 int state = pnmlist->uNewState; switch (lvinfo->hdr.code) { case LVN_ITEMCHANGED: // プロパティボタンの有効/無効を切り替える EnableWindow(GetDlgItem(hWnd, IDC_PROPERTY), lvChecked); if (pnmlist->iItem == iItem) { // 選択されているアイテムのチェックボックス if (state != (pnmlist->uOldState & LVIS_STATEIMAGEMASK)) { if (state == INDEXTOSTATEIMAGEMASK(2)) { // チェックされた EnableWindow(GetDlgItem(hWnd, IDC_PROPERTY), true); } else if (state == INDEXTOSTATEIMAGEMASK(1)) { // チェックが外された EnableWindow(GetDlgItem(hWnd, IDC_PROPERTY), false); } } } break; case NM_DBLCLK: if (lvChecked) { // チェックされていたらプロパティ画面の呼び出し OnProperty(hWnd); } break; } return true; }