Print Page | Close Window

Unhandled exception using CXTListView

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=10166
Printed Date: 14 November 2025 at 7:58pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Unhandled exception using CXTListView
Posted By: joep
Subject: Unhandled exception using CXTListView
Date Posted: 09 April 2008 at 7:59pm

In a simple, from CXTListView derived, class I have this update function:

CXTListCtrl& lc = (CXTListCtrl&)GetListCtrl();
lc.DeleteAllItems();
for (int i = 0; i < 10; i++)
{
  int nItem = lc.InsertItem(lc.GetItemCount(), "A");
  lc.SetItemData(nItem, (DWORD_PTR)123456L);
  lc.SetItemText(nItem, 1, "B");
  lc.SetItemText(nItem, 2, "C");
}
lc.AutoSizeColumn(-1);

If I comment out the line with AutoSizeColumn(), everything works OK. If I uncomment the line, I get an "Unhandled exception at 0x00000000 in Application.exe: 0xC0000005: Access violation reading location 0x000000.
 
Can anyone help me with this? Thx!



Replies:
Posted By: Oleg
Date Posted: 10 April 2008 at 1:26am
Hi,
You can 't use such line:
 
CXTListCtrl& lc = (CXTListCtrl&)GetListCtrl();
GetListCtrl returns always CListCtrl& - you can't cast it to CXTListCtrl&
 
if you have CXTListView just call directly:
 
AutoSizeColumn(-1);
 


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: joep
Date Posted: 10 April 2008 at 4:56am
Ah, silly me - overlooked that completely. Thanks!



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net