Click here to Skip to main content
15,895,370 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralCListCtrl, any way? Pin
followait4-Sep-05 19:55
followait4-Sep-05 19:55 
GeneralRe: CListCtrl, any way? Pin
Jose Lamas Rios4-Sep-05 20:04
Jose Lamas Rios4-Sep-05 20:04 
GeneralIt's ok. Thank you very much. Pin
followait4-Sep-05 20:29
followait4-Sep-05 20:29 
QuestionHow to play *.rm ? Pin
alias00184-Sep-05 15:20
alias00184-Sep-05 15:20 
AnswerRe: How to play *.rm ? Pin
Christian Graus4-Sep-05 15:35
protectorChristian Graus4-Sep-05 15:35 
QuestionNeed help with my code for infix to postfix... Pin
residually4-Sep-05 14:36
residually4-Sep-05 14:36 
AnswerRe: Need help with my code for infix to postfix... Pin
G Haranadh5-Sep-05 21:00
G Haranadh5-Sep-05 21:00 
Questionwhy does CListCtrl.InsertItem return -1? Pin
/*Trucker*\4-Sep-05 12:40
/*Trucker*\4-Sep-05 12:40 
Hello,

I am having a weird problem with a list view control (CListCtrl) in MFC. I can create it but for some reason I can't add an item to it. When I call the controls InsertItem function, it returns -1, which according to the MFC documentation means that adding the item to the list view was unsuccessful. I know this from running this code:

	//creating listview<br />
	folderContents.Create(WS_VISIBLE|WS_CHILD|WS_BORDER|<br />
						LVS_LIST|LVS_SINGLESEL,<br />
						CRect(10,10,300,180), this, <br />
						IDC_FOLDERCONTENTS);<br />
<br />
	LV_ITEM lvItem;<br />
	lvItem.mask = LVIF_TEXT|LVIF_STATE;<br />
	lvItem.state = 0;<br />
	lvItem.stateMask = 0;<br />
	lvItem.pszText = "an item";<br />
	lvItem.iItem = 0;<br />
<br />
	//add the item to the listview. If unsuccessful<br />
	//then change background color of the list view<br />
	if(folderContents.InsertItem(&lvItem) == -1)<br />
	{<br />
		COLORREF c = PALETTERGB(150, 90, 130);<br />
		folderContents.SetBkColor(c);<br />
	}


When I run the application, backgound color of the list view (named folderContents in above code) is changed. So why cant InsertItem add an item to the list view? There is no explanation in the documentation. Anybody know?Confused | :confused:

TraileR ParK LifE 4Ever
AnswerRe: why does CListCtrl.InsertItem return -1? Pin
Christian Graus4-Sep-05 14:24
protectorChristian Graus4-Sep-05 14:24 
GeneralRe: why does CListCtrl.InsertItem return -1? Pin
/*Trucker*\4-Sep-05 16:39
/*Trucker*\4-Sep-05 16:39 
Questionrefactoring tool Pin
wb4-Sep-05 11:47
wb4-Sep-05 11:47 
AnswerRe: refactoring tool Pin
Christian Graus4-Sep-05 11:59
protectorChristian Graus4-Sep-05 11:59 
QuestionIExplorer 6 runtime error! Pin
EA6_Panther4-Sep-05 8:48
EA6_Panther4-Sep-05 8:48 
AnswerRe: IExplorer 6 runtime error! Pin
Jose Lamas Rios4-Sep-05 19:33
Jose Lamas Rios4-Sep-05 19:33 
GeneralRe: IExplorer 6 runtime error! Pin
EA6_Panther5-Sep-05 2:05
EA6_Panther5-Sep-05 2:05 
Questionwindows forms extremely newbie question Pin
newbie progammer4-Sep-05 8:15
sussnewbie progammer4-Sep-05 8:15 
AnswerRe: windows forms extremely newbie question Pin
User 66584-Sep-05 10:33
User 66584-Sep-05 10:33 
AnswerRe: windows forms extremely newbie question Pin
Christian Graus4-Sep-05 10:41
protectorChristian Graus4-Sep-05 10:41 
QuestionMemory leak! need help Pin
Evil_Twin4-Sep-05 4:04
Evil_Twin4-Sep-05 4:04 
AnswerRe: Memory leak! need help Pin
Christian Graus4-Sep-05 10:42
protectorChristian Graus4-Sep-05 10:42 
AnswerRe: Memory leak! need help Pin
John M. Drescher4-Sep-05 12:58
John M. Drescher4-Sep-05 12:58 
QuestionPictures in Html Help Workshop Pin
a_kiani4-Sep-05 3:12
a_kiani4-Sep-05 3:12 
AnswerRe: Pictures in Html Help Workshop Pin
S Douglas4-Sep-05 20:52
professionalS Douglas4-Sep-05 20:52 
AnswerRe: Pictures in Html Help Workshop Pin
Marc Soleda4-Sep-05 21:06
Marc Soleda4-Sep-05 21:06 
QuestionKey codes to name Pin
Gadjuka4-Sep-05 2:52
Gadjuka4-Sep-05 2:52 

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.