Click here to Skip to main content
15,897,187 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How do I Support the Copying of Data from an Output Window to the Clip Board? Pin
BobInNJ27-Oct-09 13:36
BobInNJ27-Oct-09 13:36 
Questiondoe the cursor stay in the readonly cell Pin
prithaa27-Oct-09 3:31
prithaa27-Oct-09 3:31 
QuestionRe: doe the cursor stay in the readonly cell Pin
David Crow27-Oct-09 3:36
David Crow27-Oct-09 3:36 
AnswerRe: doe the cursor stay in the readonly cell Pin
prithaa27-Oct-09 3:39
prithaa27-Oct-09 3:39 
QuestionCan we append Recordsetptr with another Recordset Pin
pandit8427-Oct-09 2:53
pandit8427-Oct-09 2:53 
AnswerRe: Can we append Recordsetptr with another Recordset Pin
David Crow27-Oct-09 3:15
David Crow27-Oct-09 3:15 
GeneralRe: Can we append Recordsetptr with another Recordset Pin
pandit8427-Oct-09 4:54
pandit8427-Oct-09 4:54 
QuestionProblem with icon style CListCtrl on Vista, but not on XP Pin
Sternocera27-Oct-09 2:51
Sternocera27-Oct-09 2:51 
Hello,

I'm working on an MFC application. For reasons I cannot fathom, there seems to be a problem with inconsistent display of the icons of an icon style CListCtrl between versions of Windows (XP and Vista). On Vista, one of the icons (Debtor statement) is omitted. This only occurs sometimes. When it actually occurs varies from build to build of the application, where changes between builds ought to have no bearing on this at all.

Why might this be? How can the problem be fixed? Here is the relevant code:

CMyReportView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();


ModifyStyleEx(WS_EX_CLIENTEDGE, 0, SWP_FRAMECHANGED);


ReportsCtrl.ModifyStyle(0, LVS_AUTOARRANGE);

// Send an ID_RELOAD rather than calling UpdateStateData() directly - this is
// a hack to work around the problem of no icons being displayed initially
// in release build
SendMessage(ID_RELOAD );

}

CMyReportView::UpdateData()  // called when ID_RELOAD is received, sent from OnInitialUpdate
{
        // Load your imagelist bitmap (bmp) here, however
	//   you feel like (e.g. CBitmap::LoadBitmap)
	CBitmap sales_bitmap,
		daily_reconciliation_bitmap,
		debtor_statement_bitmap,
		debtor_invoice_bitmap,
		voided_items_bitmap,
		suspended_sales_bitmap,
		stock_count_rep_bitmap,
		live_stock_figures_bitmap,
		sales_by_item,
		pos_download_bitmap;


	sales_bitmap.LoadBitmap(IDB_SALES);
	daily_reconciliation_bitmap.LoadBitmap(IDB_DAILY_RECONCILIATION);
	debtor_statement_bitmap.LoadBitmap(IDB_DEBTOR_STATEMENT); 
	debtor_invoice_bitmap.LoadBitmap(IDB_DEBTOR_INVOICE); 
	voided_items_bitmap.LoadBitmap(IDB_ICON_VOID); 
	suspended_sales_bitmap.LoadBitmap(IDB_SUSPENDED_SALES_ICON);
	stock_count_rep_bitmap.LoadBitmap(IDB_STOCK_COUNT_REPORT_ICON);
	live_stock_figures_bitmap.LoadBitmap(IDB_ICON_LIVE_STOCK_FIGURES);
	sales_by_item.LoadBitmap(IDB_SALES_BY_ITEM_ICON);
	pos_download_bitmap.LoadBitmap(IDB_POS_DOWNLOAD_REPORT_ICON);

	// Set up your transparent colour as appropriate
	COLORREF rgbTransparentColour = RGB(255, 255, 255);
	imgl.Create(64, 64, ILC_MASK | ILC_COLOR32, 0, 0);
	
	// Add the bitmap into the image list
	int sales_bit_id = imgl.Add(&sales_bitmap, rgbTransparentColour);
	int daily_rec_bit_id = imgl.Add(&daily_reconciliation_bitmap, rgbTransparentColour);
	int debtor_stat_bit_id = imgl.Add(&debtor_statement_bitmap, rgbTransparentColour);
	int debt_invo_bit_id = imgl.Add(&debtor_invoice_bitmap, rgbTransparentColour);
	int voided_itms_bit_id = imgl.Add(&voided_items_bitmap, rgbTransparentColour);
	int suspend_sls_bit_id = imgl.Add(&suspended_sales_bitmap, rgbTransparentColour);
	int stock_count_bit_id = imgl.Add(&stock_count_rep_bitmap, rgbTransparentColour);
	int live_stock_figures_bit_id = imgl.Add(&live_stock_figures_bitmap, rgbTransparentColour);
	int sales_by_item_bit_id = imgl.Add(&sales_by_item, rgbTransparentColour);
	int pos_day_end_download_bit_id = imgl.Add(&pos_download_bitmap, rgbTransparentColour);

	// now, to set my image list as pCtrl's image list
	ReportsCtrl.SetImageList(&imgl, 0);

	LVITEM lvi0;
	lvi0.mask =  LVIF_IMAGE | LVIF_TEXT;
	lvi0.iSubItem = 0;
	lvi0.pszText = "Sales report";
	lvi0.iImage = sales_bit_id;

	LVITEM lvi1;
	lvi1.mask =  LVIF_IMAGE | LVIF_TEXT;
	lvi1.iSubItem = 0;
	lvi1.pszText = "Daily reconciliation report";
	lvi1.iImage = daily_rec_bit_id;

	LVITEM lvi2;
	lvi2.mask =  LVIF_IMAGE | LVIF_TEXT;
	lvi2.iSubItem = 0;
	lvi2.pszText = "Debtor statement";
	lvi2.iImage = debtor_stat_bit_id;

	LVITEM lvi3;
	lvi3.mask =  LVIF_IMAGE | LVIF_TEXT;
	lvi3.iSubItem = 0;
	lvi3.pszText = "Debtor invoice";
	lvi3.iImage = debt_invo_bit_id;

	LVITEM lvi4;
	lvi4.mask =  LVIF_IMAGE | LVIF_TEXT;
	lvi4.iSubItem = 0;
	lvi4.pszText = "Voided items report";
	lvi4.iImage = voided_itms_bit_id;

	LVITEM lvi5;
	lvi5.mask =  LVIF_IMAGE | LVIF_TEXT;
	lvi5.iSubItem = 0;
	lvi5.pszText = "Suspended sales report";
	lvi5.iImage = suspend_sls_bit_id;

	LVITEM lvi6;
	lvi6.mask =  LVIF_IMAGE | LVIF_TEXT;
	lvi6.iSubItem = 0;
	lvi6.pszText = "Stock count report";
	lvi6.iImage = stock_count_bit_id;

	LVITEM lvi7;
	lvi7.mask =  LVIF_IMAGE | LVIF_TEXT;
	lvi7.iSubItem = 0;
	lvi7.pszText = "Live stock figures report";
	lvi7.iImage = live_stock_figures_bit_id;

	LVITEM lvi8;
	lvi8.mask =  LVIF_IMAGE | LVIF_TEXT;
	lvi8.iSubItem = 0;
	lvi8.pszText = "Sales by item report";
	lvi8.iImage = sales_by_item_bit_id;

	LVITEM lvi9;
	lvi9.mask =  LVIF_IMAGE | LVIF_TEXT;
	lvi9.iSubItem = 0;
	lvi9.pszText = "POS day-ends report";
	lvi9.iImage = pos_day_end_download_bit_id;


	

	int sales = ReportsCtrl.InsertItem(&lvi0);
	ReportsCtrl.SetItemData(sales, 1);
	int daily_reconcil = ReportsCtrl.InsertItem(&lvi1);
	ReportsCtrl.SetItemData(daily_reconcil, 2);
	int debtor_statement = ReportsCtrl.InsertItem(&lvi2);
	ReportsCtrl.SetItemData(debtor_statement, 3);
	int debtor_invoice = ReportsCtrl.InsertItem(&lvi3);
	ReportsCtrl.SetItemData(debtor_invoice, 4);
	int voided_items =  ReportsCtrl.InsertItem(&lvi4);
	ReportsCtrl.SetItemData(voided_items, 5);
	int suspended_sales =  ReportsCtrl.InsertItem(&lvi5);
	ReportsCtrl.SetItemData(suspended_sales, 6);
	int stock_count =  ReportsCtrl.InsertItem(&lvi6);
	ReportsCtrl.SetItemData(stock_count, 7);
	int live_stock_figures = ReportsCtrl.InsertItem(&lvi7);
	ReportsCtrl.SetItemData(live_stock_figures, 8);
	int sales_item = ReportsCtrl.InsertItem(&lvi8);
	ReportsCtrl.SetItemData(sales_item, 9);
	int pos_download = ReportsCtrl.InsertItem(&lvi9);
	ReportsCtrl.SetItemData(pos_download, 10);


	// select first report
	ReportsCtrl.SetItemState(ReportsCtrl.GetItemCount() - 1, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
}


Any assistance is greatly appreciated.

Regards,
Sternocera
AnswerRe: Problem with icon style CListCtrl on Vista, but not on XP Pin
Sternocera27-Oct-09 3:10
Sternocera27-Oct-09 3:10 
QuestionRe: Problem with icon style CListCtrl on Vista, but not on XP Pin
Randor 27-Oct-09 3:27
professional Randor 27-Oct-09 3:27 
AnswerRe: Problem with icon style CListCtrl on Vista, but not on XP Pin
Sternocera27-Oct-09 3:29
Sternocera27-Oct-09 3:29 
QuestionRe: Problem with icon style CListCtrl on Vista, but not on XP Pin
David Crow27-Oct-09 3:34
David Crow27-Oct-09 3:34 
AnswerRe: Problem with icon style CListCtrl on Vista, but not on XP Pin
Sternocera27-Oct-09 3:37
Sternocera27-Oct-09 3:37 
AnswerRe: Problem with icon style CListCtrl on Vista, but not on XP Pin
Michael Dunn27-Oct-09 14:38
sitebuilderMichael Dunn27-Oct-09 14:38 
GeneralRe: Problem with icon style CListCtrl on Vista, but not on XP Pin
Sternocera27-Oct-09 23:48
Sternocera27-Oct-09 23:48 
AnswerRe: Problem with icon style CListCtrl on Vista, but not on XP Pin
Greg Prosch30-Oct-09 12:30
Greg Prosch30-Oct-09 12:30 
GeneralRe: Problem with icon style CListCtrl on Vista, but not on XP Pin
Sternocera30-Oct-09 12:32
Sternocera30-Oct-09 12:32 
QuestionCalling WPF pages in VC++ Pin
kDevloper27-Oct-09 2:50
kDevloper27-Oct-09 2:50 
QuestionIcmpSendEcho error: 1231 Pin
Manmohan2927-Oct-09 2:25
Manmohan2927-Oct-09 2:25 
AnswerRe: IcmpSendEcho error: 1231 Pin
Sternocera27-Oct-09 3:06
Sternocera27-Oct-09 3:06 
QuestionRe: IcmpSendEcho error: 1231 Pin
David Crow27-Oct-09 3:19
David Crow27-Oct-09 3:19 
AnswerRe: IcmpSendEcho error: 1231 Pin
Manmohan2927-Oct-09 3:30
Manmohan2927-Oct-09 3:30 
QuestionRe: IcmpSendEcho error: 1231 Pin
David Crow27-Oct-09 3:40
David Crow27-Oct-09 3:40 
AnswerRe: IcmpSendEcho error: 1231 Pin
Manmohan2927-Oct-09 4:44
Manmohan2927-Oct-09 4:44 
GeneralRe: IcmpSendEcho error: 1231 Pin
David Crow27-Oct-09 4:47
David Crow27-Oct-09 4:47 

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.