Microsoft KB Archive/62741

= Microsoft Knowledge Base =

Do Not Call Message Boxes Via Radio Buttons
Last reviewed: July 22, 1997

Article ID: Q62741

3.00 3.10 WINDOWS kbprg

The information in this article applies to:


 * Microsoft Windows Software Development Kit (SDK) for Windows versions 3.0 and 3.1

When programming calls to MessageBox in response to dialog box controls, you may observe the following phenomenon.

An application-modal message box that is opened within the processing logic for a radio button control crashes the system (you keep getting message boxes until USER runs out of local heap space). There is no problem as soon as you replace the radio button style by a push button style.

Although this is a problem in Windows, there should not really be a need to use this feature at all. Radio buttons are designed to be a mechanism to choose between mutually exclusive options (for more information, refer to the CUA style guide). Opening a message box as a direct response to the selection of a radio button is not a preferred programming technique. If the selected option raises some kind of error, the radio button can always be disabled using the EnableWindow function.