Click here to Skip to main content
15,916,941 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to import VB interface in VC++ programming?How to link the interface with VC++ codes Pin
Christian Graus5-Sep-05 16:08
protectorChristian Graus5-Sep-05 16:08 
QuestionProgress Dialog Pin
LighthouseJ4-Sep-05 17:08
LighthouseJ4-Sep-05 17:08 
QuestionRemoving Drivers from a system Pin
Peter Prescher4-Sep-05 16:58
Peter Prescher4-Sep-05 16:58 
AnswerRe: Removing Drivers from a system Pin
Gary R. Wheeler5-Sep-05 5:55
Gary R. Wheeler5-Sep-05 5:55 
GeneralRe: Removing Drivers from a system Pin
Peter Prescher5-Sep-05 9:04
Peter Prescher5-Sep-05 9:04 
QuestionWhere to delete item data with CListCtrl Pin
followait4-Sep-05 16:24
followait4-Sep-05 16:24 
AnswerRe: Where to delete item data with CListCtrl Pin
Jose Lamas Rios4-Sep-05 19:12
Jose Lamas Rios4-Sep-05 19:12 
GeneralThank you. It works. Pin
followait4-Sep-05 19:54
followait4-Sep-05 19:54 
AnswerRe: Where to delete item data with CListCtrl Pin
Kelly Herald4-Sep-05 20:06
Kelly Herald4-Sep-05 20:06 
GeneralRe: Where to delete item data with CListCtrl Pin
Jose Lamas Rios4-Sep-05 20:26
Jose Lamas Rios4-Sep-05 20:26 
GeneralIt doesn't help to delete item data. Pin
followait4-Sep-05 20:43
followait4-Sep-05 20:43 
GeneralRe: It doesn't help to delete item data. Pin
Kelly Herald6-Sep-05 4:07
Kelly Herald6-Sep-05 4:07 
QuestionConnection to SQL? Pin
Member 21004814-Sep-05 16:22
Member 21004814-Sep-05 16:22 
AnswerRe: Connection to SQL? Pin
Steve S5-Sep-05 0:11
Steve S5-Sep-05 0:11 
QuestionPrinting Pin
Ivan Cachicatari4-Sep-05 16:00
Ivan Cachicatari4-Sep-05 16:00 
QuestionHow to determine if a window has scroll bar? Pin
followait4-Sep-05 15:25
followait4-Sep-05 15:25 
AnswerRe: How to determine if a window has scroll bar? Pin
Jose Lamas Rios4-Sep-05 19:22
Jose Lamas Rios4-Sep-05 19:22 
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

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.