Listbox crashes in Win95
Robert Tenback -- Robert.Tenback@let.ruu.nl
Monday, December 09, 1996
Environment: Win95, VC++4.2b
Problem:
I am using a Listbox with the styles LB_OWNERDRAWVARIABLE
and LB_HASSTRINGS. I derive this from the standard MFC CListBox,
and I handle the WM_MEASUREITEM message myself.
The LPMEASUREITEM pointer points to a MEASUREITEMSTRUCT
that contains an itemData pointer. This pointer should point to a string.
In Windows NT, this works fine. In Windows 95, it crashes because this
pointer points to bogus data.
Question:
* Is this a VC4.2 bug, or a Win95 bug?
* Is there a fix/patch/workaround?
Regards,
Robert Tenback
____ ___ ___ ___ ___ _____
drs. Robert Tenback / / / / / / / / / /
Utrecht University /---/ / / /--/ /-- /--/ /
Faculty of Arts / \ /__/ /__/ /___ / \ /
Dept. Computers and Humanities Robert.Tenback@let.ruu.nl
Eric clinidata -- nm94318@clinidata.com
Thursday, December 12, 1996
[Mini-digest: 2 responses]
Hello Robert,
I've go the same problem before, what's happening is that the
WM_MEASUREITEM is sent to you when you do your AddString (right after it)
and before you SetItemDataPtr (I guess you're calling this function).
The fact that it doesn't crash in NT is probably just luck.
Hope it helps you.
P.S. Thank you David for coming back as the right one to manage the list,
I was very close to quit it!
Eric Lamontagne
Clinidata Inc.
elamontagne@Clinidata.com
-----From: joew@statsoft.com (Joe Willcoxson)
>Environment: Win95, VC++4.2b
>
>Problem:
>I am using a Listbox with the styles LB_OWNERDRAWVARIABLE
>and LB_HASSTRINGS. I derive this from the standard MFC CListBox,
>and I handle the WM_MEASUREITEM message myself.
>
>The LPMEASUREITEM pointer points to a MEASUREITEMSTRUCT
>that contains an itemData pointer. This pointer should point to a string.
>In Windows NT, this works fine. In Windows 95, it crashes because this
>pointer points to bogus data.
>
>Question:
>* Is this a VC4.2 bug, or a Win95 bug?
>* Is there a fix/patch/workaround?
This really isn't an MFC question is it? My documentation says that
itemData should be NULL for a LISTBOX that has the LB_OWNERDRAWVARIABLE and
LB_HASSTRINGS style. It would be a LPCTSTR if it DID NOT have the
LB_HASSTRINGS style. If you want to get the string, use the itemID member
and call GetText(). You just got lucky or detected a bug in NT. This is a
really lame question for a supposedly intermediate/advanced MFC list. David
is waaaaaaaayyyy too kind.
--
Gloria in excelsius Deo
Joe Willcoxson (joew@statsoft.com), Senior Software Engineer
Visit us: http://www.statsoft.com, Visit me: http://users.aol.com/chinajoe
#define STD_DISCLAIMER "I speak only for myself"
__cplusplus spoken here;
| Вернуться в корень Архива
|