Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Unhandled exception using CXTListView
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Unhandled exception using CXTListView

 Post Reply Post Reply
Author
Message
joep View Drop Down
Groupie
Groupie


Joined: 18 February 2004
Location: Netherlands
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote joep Quote  Post ReplyReply Direct Link To This Post Topic: Unhandled exception using CXTListView
    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!
Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
joep View Drop Down
Groupie
Groupie


Joined: 18 February 2004
Location: Netherlands
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote joep Quote  Post ReplyReply Direct Link To This Post Posted: 10 April 2008 at 4:56am
Ah, silly me - overlooked that completely. Thanks!
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.047 seconds.