troubleshooting Question

ListView

Avatar of tariq6000
tariq6000 asked on
System Programming
4 Comments1 Solution321 ViewsLast Modified:
Hi,
I am using ListView with 4 coloumn to list some strings. I want to add bitmap at firstcolumn with string. I have written some code but not working please help:
CListCtrl &LstPtr=GetListCtrl();
//---------execute only once---------------------
CBitmap bitmap;
ImageList.Create(16, 16, ILC_COLOR32|ILC_MASK,9,0);
bitmap.LoadBitmap(IDB_TREE);//Tree Bitmap//just try
ImageList.Add(&bitmap, 0xFFFFFF);
LstPtr.SetImageList(&ImageList,TVSIL_NORMAL);
bitmap.DeleteObject();
//----------------------------------------

//-Function Add string to List view-----------

LRESULT CListViewRight::OnMsgAddStringToListCtrl(WPARAM wParam,LPARAM lParam)
{
CListCtrl &LstPtr=GetListCtrl();
//Top to bottom
int nItem=(int)lParam;
GetListViewLineNumber(nItem);

switch(nItem)
{
case 1:

LstPtr.InsertItem(m_nListViewLineNumber,(LPCTSTR(wParam)),0);
break;

case 2:
LstPtr.SetItemText(m_nListViewLineNumber,1,(LPCTSTR(wParam)));
break;

case 3:
LstPtr.SetItemText(m_nListViewLineNumber,2,(LPCTSTR(wParam)));
break;

case 4:
LstPtr.SetItemText(m_nListViewLineNumber,3,(LPCTSTR(wParam)));
break;
}
return TRUE;
}
ASKER CERTIFIED SOLUTION
roytal

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros