Microsoft KB Archive/129494

From BetaArchive Wiki

Article ID: 129494

Article Last Modified on 11/21/2006



APPLIES TO

  • Microsoft Foundation Class Library 4.2, when used with:
    • Microsoft Visual C++ 1.0 Professional Edition
    • Microsoft Visual C++ 1.5 Professional Edition
    • Microsoft Visual C++ 1.51
    • Microsoft Visual C++ 1.52 Professional Edition
    • Microsoft Visual C++ 1.0 Professional Edition
    • Microsoft Visual C++ 2.0 Professional Edition
    • Microsoft Visual C++ 2.1
    • Microsoft Visual C++ 4.0 Standard Edition



This article was previously published under Q129494

SUMMARY

A General Protection Fault (GPF) or Application Error occurs when attempting to display a dialog box or FormView that contains a list box with both the multicolumn (LBS_MULTICOLUMN) and ownerdraw, variable height (LBS_OWNERDRAWVARIABLE) styles.

CAUSE

This is expected behavior. Windows, Windows NT, and Windows 95 do not support multicolumn, ownerdraw, variable height list boxes.

RESOLUTION

For list boxes that are owner drawn and multicolumn, use the fixed height style (LBS_OWNERDRAWFIXED).

For list boxes that are owner drawn and use the variable height style (LBS_OWNERDRAWVARIABLE), do not use the multicolumn style (LBS_MULTICOLUMN).

MORE INFORMATION

The Dialog Editor that ships with all versions of Visual C++ prior to version 4.0 incorrectly allow these incompatible styles to be combined using the check boxes on the property page for the list box control. (Visual C++, 32-bit Edition, version 4.0 disables the Multi-column check box when Variable is the setting selected for Owner draw.) These styles, LBS_MULTICOLUMN and LBS_OWNERDRAWVARIABLE, may also be combined incorrectly if the dialog box resource file (.RC) is edited directly.

Steps to Reproduce Problem

The problem can be reproduced by modifying the CTRLTEST sample:

  1. Open AppStudio on CTRLTEST project.
  2. Open IDD_CUSTOM_LIST dialog box.
  3. Select the list box.
  4. In the ListBox Properties Dialog, go to Styles.
  5. Select MultiColumn and OwnerDraw as Variable Styles.
  6. Build and Execute the sample.
  7. The GP fault occurs when you choose the menu item (Custom\Custom ListBox).

To reproduce the problem using Visual C++ version 4.0, use the following steps:

  1. Open CTRLTEST.RC in a text editor (for example, NotePad).
  2. Add "| LBS_MULTICOLUMN" to the list of styles for the LISTBOX object of the IDD_CUSTOM_LIST DIALOG object.
  3. Save and close CTRLTEST.RC.
  4. Open the CTRLTEST project in Developer Studio.
  5. Build and Execute the sample.
  6. The Application Error occurs when you choose the Custom ListBox option from the Custom menu.



Additional query words: listbox

Keywords: kbprb KB129494