MFC错误:CListCtrl问题 [英] MFC Error: Problem with CListCtrl
问题描述
大家好,
我正在MFC中开发基于对话框的应用程序,并且具有带有复选框的CListCtrl.代码如下:
Hi everyone there,
I am developing a dialog based application in MFC and I have a CListCtrl with checkboxes. Code is as follows:
CListCtrl m_gridOutput;m_gridOutput.SetExtendedStyle(m_gridCtrlEx.GetExtendedStyle() | LVS_EX_CHECKBOXES);
我可以跟踪ListControl中的更改,但是现在我试图更改项目复选框的状态.不幸的是,当我尝试使用以下代码时,我遇到断言错误.
I can track the changes in the ListControl but now I am trying to change the status of the Checkbox of an item. Unfortunately I am getting Assertion errors, when I try to use the following piece of code.
m_gridOutput.SetItem(1,0,LVIF_STATE,NULL,0,dwFlags,dwFlags,0);
(or)
ListView_SetItemState(m_gridOutput.GetSafeHwnd(),VarId,INDEXTOSTATEIMAGEMASK((fCheck)+ 1), LVIS_STATEIMAGEMASK);
(or)
ListView_SetCheckState((m_gridOutput.GetSafeHwnd(),Id,TRUE);
我想在这里再添加一件事.如果在OnInitDialog()
中使用SetCheck (or) ListView_SetCheckState
,它可以正常工作.但是,如果我尝试在单独的函数中使用它,则会产生断言错误.如何处理?.
任何帮助将不胜感激.
Shiva
I want to add one more thing here. If I use SetCheck (or) ListView_SetCheckState
in OnInitDialog()
, it works fine. But if I try to use it in a seperate function, it gives assertion error. How to handle this?.
Any help is greatly appreciated.
Shiva
推荐答案
存在此问题的答案:
MFC错误:CListCtrl中的断言错误 [ ^ ]
An answer exists to this question:
MFC Error: Assertion Error in CListCtrl[^]
这篇关于MFC错误:CListCtrl问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!