本文整理汇总了C++中ListView_SetCheckState函数的典型用法代码示例。如果您正苦于以下问题:C++ ListView_SetCheckState函数的具体用法?C++ ListView_SetCheckState怎么用?C++ ListView_SetCheckState使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ListView_SetCheckState函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ListView_DeleteAllItems
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);
}
}
示例2: ListView_GetItem
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);
}
示例3: LVItemSetCheckAll
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);
}
}
示例4: mm_mod_list_install_mod
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);
}
示例5: SetWindowText
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);
}
}
}
示例6: ZeroMemory
// 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);
}
}
示例7: LoadDictionary
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);
}
示例8: InitListViewContorol
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++;
}
}
示例9: PopulateRulesList
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);
}
}
示例10: ListView_SetCheckState
void CSysLogQuery::CheckAllItems(BOOL fChecked)
{
for(int nItem = 0;nItem < ListView_GetItemCount(m_Syslog_query);nItem++)
{
ListView_SetCheckState(m_Syslog_query,nItem,fChecked);
}
}
示例11: UpdateList
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;
}
示例12: Watch
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;
}
示例13: AddDataBp
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);
}
}
示例14: ListView_MoveItem
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;
}
示例15: ListView_SetCheckState
// 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 );
}