Click here to Skip to main content
15,398,432 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: can i use mem_fun like this? Pin
Stephen Hewitt2-Dec-12 4:45
MemberStephen Hewitt2-Dec-12 4:45 
AnswerRe: can i use mem_fun like this? Pin
troyxyz2-Dec-12 6:21
Membertroyxyz2-Dec-12 6:21 
AnswerRe: can i use mem_fun like this? Pin
Stefan_Lang3-Dec-12 2:14
mveStefan_Lang3-Dec-12 2:14 
AnswerRe: can i use mem_fun like this? Pin
Stefan_Lang3-Dec-12 3:45
mveStefan_Lang3-Dec-12 3:45 
GeneralRe: can i use mem_fun like this? Pin
Falconapollo4-Dec-12 14:43
MemberFalconapollo4-Dec-12 14:43 
Questionclient server for running the program Pin
danielsutopo1-Dec-12 15:09
Memberdanielsutopo1-Dec-12 15:09 
AnswerRe: client server for running the program Pin
Albert Holguin1-Dec-12 17:22
professionalAlbert Holguin1-Dec-12 17:22 
QuestionLimiting selected checkbox items in a CListCtrl Pin
softwaremonkey1-Dec-12 1:40
Membersoftwaremonkey1-Dec-12 1:40 
I have a CListCtrl with the LVS_EX_CHECKBOXES style and I want to limit the number of items that the user can select. I have written the following code but (of course) it gets itself in a loop because in changing the state of an item, it causes OnItemchangingLoadingValues() to be called again.

C++
void CSpecimenLoadingDialog::OnItemchangingLoadingValues(NMHDR* pNMHDR, LRESULT* pResult) 
{
	NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
	int nCheckedItems = 0;
	for(int i = 0; i < m_loadingVals.GetItemCount(); i++)
	{
		BOOL bState = ListView_GetCheckState(m_loadingVals.m_hWnd, i);
		if(bState)
		{
			nCheckedItems++;
		}
	}

	if(nCheckedItems == 2)
	{
		ListView_SetItemState(m_loadingVals.m_hWnd, pNMListView->iItem, FALSE, LVIS_STATEIMAGEMASK);
	}

	*pResult = 0;
}


What is the correct way to go about doing this? Unsure | :~
SuggestionRe: Limiting selected checkbox items in a CListCtrl Pin
David Crow1-Dec-12 3:51
MemberDavid Crow1-Dec-12 3:51 
AnswerRe: Limiting selected checkbox items in a CListCtrl Pin
Jochen Arndt1-Dec-12 23:56
professionalJochen Arndt1-Dec-12 23:56 
GeneralRe: Limiting selected checkbox items in a CListCtrl Pin
softwaremonkey2-Dec-12 22:45
Membersoftwaremonkey2-Dec-12 22:45 
QuestionUsing VISUAL C++ 6.0 with OLE Pin
ForNow30-Nov-12 9:06
MemberForNow30-Nov-12 9:06 
AnswerRe: Using VISUAL C++ 6.0 with OLE Pin
jschell30-Nov-12 10:46
Memberjschell30-Nov-12 10:46 
SuggestionRe: Using VISUAL C++ 6.0 with OLE Pin
David Crow30-Nov-12 14:24
MemberDavid Crow30-Nov-12 14:24 
GeneralRe: Using VISUAL C++ 6.0 with OLE Pin
ForNow4-Dec-12 13:48
MemberForNow4-Dec-12 13:48 
AnswerRe: Using VISUAL C++ 6.0 with OLE Pin
Stephen Hewitt2-Dec-12 4:54
MemberStephen Hewitt2-Dec-12 4:54 
AnswerRe: Using VISUAL C++ 6.0 with OLE Pin
Cristian Amarie3-Dec-12 8:52
MemberCristian Amarie3-Dec-12 8:52 
QuestionDll injection and hooking Pin
miniman0630-Nov-12 7:47
Memberminiman0630-Nov-12 7:47 
AnswerRe: Dll injection and hooking Pin
miniman061-Dec-12 19:01
Memberminiman061-Dec-12 19:01 
Questionsimple program in linux doesnt work Pin
a1_shay29-Nov-12 22:59
Membera1_shay29-Nov-12 22:59 
AnswerRe: simple program in linux doesnt work Pin
Graham Breach30-Nov-12 0:24
MemberGraham Breach30-Nov-12 0:24 
GeneralRe: simple program in linux doesnt work Pin
a1_shay30-Nov-12 1:43
Membera1_shay30-Nov-12 1:43 
AnswerRe: simple program in linux doesnt work Pin
jschell30-Nov-12 10:49
Memberjschell30-Nov-12 10:49 
QuestionRead binary File Pin
002comp28-Nov-12 23:05
Member002comp28-Nov-12 23:05 
AnswerRe: Read binary File Pin
Richard MacCutchan28-Nov-12 23:14
mveRichard MacCutchan28-Nov-12 23:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.