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

C / C++ / MFC

 
AnswerRe: Populated Dialog box is not focused Pin
pandit8419-May-09 0:27
pandit8419-May-09 0:27 
GeneralRe: Populated Dialog box is not focused Pin
«_Superman_»19-May-09 0:32
professional«_Superman_»19-May-09 0:32 
GeneralRe: Populated Dialog box is not focused Pin
pandit8419-May-09 1:40
pandit8419-May-09 1:40 
GeneralRe: Populated Dialog box is not focused Pin
Chandrasekharan P19-May-09 2:03
Chandrasekharan P19-May-09 2:03 
Question[RESOLVED]using enum in #if preprocessor directive [modified] Pin
Priya_Sundar18-May-09 23:20
Priya_Sundar18-May-09 23:20 
AnswerRe: using enum in #if preprocessor directive Pin
«_Superman_»18-May-09 23:37
professional«_Superman_»18-May-09 23:37 
GeneralRe: using enum in #if preprocessor directive Pin
Taran919-May-09 0:22
Taran919-May-09 0:22 
GeneralRe: using enum in #if preprocessor directive Pin
«_Superman_»19-May-09 0:25
professional«_Superman_»19-May-09 0:25 
GeneralRe: using enum in #if preprocessor directive Pin
Taran919-May-09 0:35
Taran919-May-09 0:35 
GeneralRe: using enum in #if preprocessor directive Pin
«_Superman_»19-May-09 0:38
professional«_Superman_»19-May-09 0:38 
GeneralRe: using enum in #if preprocessor directive Pin
Taran919-May-09 0:51
Taran919-May-09 0:51 
GeneralRe: using enum in #if preprocessor directive Pin
Rajesh R Subramanian19-May-09 0:30
professionalRajesh R Subramanian19-May-09 0:30 
AnswerRe: using enum in #if preprocessor directive Pin
Perisic, Aleksandar18-May-09 23:50
Perisic, Aleksandar18-May-09 23:50 
GeneralRe: using enum in #if preprocessor directive Pin
Priya_Sundar19-May-09 0:11
Priya_Sundar19-May-09 0:11 
Questionbackground image for toolbar base on dialog Pin
yiyinkuang18-May-09 22:15
yiyinkuang18-May-09 22:15 
AnswerRe: background image for toolbar base on dialog Pin
_AnsHUMAN_ 18-May-09 23:11
_AnsHUMAN_ 18-May-09 23:11 
GeneralRe: background image for toolbar base on dialog Pin
yiyinkuang18-May-09 23:28
yiyinkuang18-May-09 23:28 
GeneralRe: background image for toolbar base on dialog Pin
_AnsHUMAN_ 19-May-09 0:33
_AnsHUMAN_ 19-May-09 0:33 
GeneralRe: background image for toolbar base on dialog Pin
yiyinkuang19-May-09 15:22
yiyinkuang19-May-09 15:22 
Questioncontrolling system volume by vc++ Pin
B060611518-May-09 22:11
B060611518-May-09 22:11 
AnswerRe: controlling system volume by vc++ Pin
Chandrasekharan P18-May-09 22:36
Chandrasekharan P18-May-09 22:36 
QuestionRe: controlling system volume by vc++ Pin
David Crow19-May-09 5:01
David Crow19-May-09 5:01 
AnswerRe: controlling system volume by vc++ Pin
B060611519-May-09 23:46
B060611519-May-09 23:46 
QuestionCreating a column with bitmaps on CListCtrl residing on a dialog Pin
JJeffrey18-May-09 21:37
JJeffrey18-May-09 21:37 
Sorry to trouble you guys, but I think I'm missing something in my understanding of the List Control boxes.

I'm creating a CListCtrl box with 3 columns. The first 2 are text and the third will show bitmaps. My code goes like this:

void PopulateList ()
{
	LVCOLUMN lvColumn1,lvColumn2,lvColumn3;					
	COLORREF rgbMask = RGB(0,0,0);	//(rgb[0].rgbtRed, rgb[0].rgbtGreen, rgb[0].rgbtBlue);
        // I believe I need to create a CImageList for the bitmap column, right?
	CImageList	ThumbList;
	ThumbList.Create(MAXWIDTH, MAXHEIGHT, ILC_COLOR, 1, 1);


	//Create Column 1
	lvColumn1.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH;
	lvColumn1.fmt = Alignment;
	lvColumn1.cx = 120;
	lvColumn1.pszText = ColumnHeading[0];
	nCol = m_MainList.InsertColumn(0, &lvColumn1);

	int NextIndex = nCol;

	//Populate Column 1
	while (!EOF)
        {
          //Read the Data from File and store in "OutputTitle"
          .
          .
          LVITEM lvItem;
	  lvItem.mask = LVIF_TEXT;
	  lvItem.iItem = NextIndex;
	  lvItem.iSubItem = 0;
	  lvItem.pszText = OutputTitle;
	  NextIndex = m_MainList.InsertItem(&lvItem);
          .
        }
	ListView_SortItemsEx( m_MainList.m_hWnd, CompareProc, (LPARAM)&m_MainList );

	//Create Column 2
	lvColumn2.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH;
	lvColumn2.fmt = Alignment;
	lvColumn2.cx = 120;
	lvColumn2.pszText = ColumnHeading[1];
	nCol = m_MainList.InsertColumn(1, &lvColumn2);

	//Populate Column 2
	int NumOfEntries = m_MainList.GetItemCount();
	
	for(int i=0; i>NumOfEntries; i++)
	{
           //Get data based on First Column entries
           .
           .
           .
	   m_MainList.SetItemText(i,1, <Data>);
	}

	//Create Column 3
	lvColumn3.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH;
	lvColumn3.fmt = Alignment;
	lvColumn3.cx = 240;
	lvColumn3.pszText = ColumnHeading[2];
	nCol = m_MainList.InsertColumn(2, &lvColumn3);
	

	NextIndex = nCol;

	//Populate Column 3
	BYTE PreviewInfo[MAXHEIGHT][MAXWIDTH][3]={0};
	int ImageIndex = 0;
	
	for(int i=0; i<NumOfEntries; i++)
	{
		BOOL ValidPicture = ReadDataFromDataFile(.....);

		if(ValidPicture)
		{
			HBITMAP Picture = <Data Read>
			CBitmap	*ThumbNail = new CBitmap;
			ThumbNail->Attach(Picture );
			ImageIndex = ThumbList.Add(ThumbNail,rgbMask);
			m_MainList.SetImageList(&ThumbList, LVSIL_SMALL);

			LVITEM lvItem;
			lvItem.mask = LVIF_IMAGE;
			lvItem.iItem = i;              // I tried
			lvItem.iSubItem = 0;
			lvItem.iImage = ImageIndex;
			NextIndex = m_MainList.InsertItem(&lvItem);	
			delete ThumbNail;		
		}
		else NextIndex++;
	}
	

}


m_MainList is the handle to the CListCtrl on the dialog


If I don't code in the Column 3 code, I get my first 2 columns ok. Once I do put in the Column 3 code, Column 1 data all disappears and Column 3 also has no data.
I believe the problem is in my declaration of the CImageList and how I am putting it into the Column, but I don't know what is wrong and also why Column 1 is being affected.

Can someone point me in the right direction here?
AnswerRe: Creating a column with bitmaps on CListCtrl residing on a dialog Pin
Stuart Dootson18-May-09 22:49
professionalStuart Dootson18-May-09 22:49 

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.