Reducing the Size of Message Boxes (Windows CE 5.0)
You can reduce the size of the message boxes created by the MessageBox function by setting registry keys to selectively hide the Cancel and Ignore buttons. This functionality is useful when the screen size is limited by the size of the target device or because of localization issues. You can then append a message to the message box that describes how to proceed without these buttons.
If you set the registry key to hide the Cancel button:
- The Cancel button does not appear on the message box when a request to the MessageBox function is made for the Yes, No, and Cancel button combination.
- The Close button takes on the functionality of the Cancel button.
If you set the registry key to hide the Ignore button:
- The Ignore button does not appear on the message box when a request to the MessageBox function is made for the Abort, Retry, and Ignore button combination.
- The Close button takes on the functionality of the Ignore button.
To hide the Cancel button and remap its functionality
Add the following registry key:
[HKEY_LOCAL_MACHINE\SYSTEM\GWE\MsgBox] "NoCancelText"="This text is appended to the message text."
Set the value of
NoCancelText
to a string.NoCancelText
is a REG_SZ value. If the registry key is not present or is a zero-length string, the Cancel button appears as usual. If the string is a single blank, the Cancel button is removed, but no text is added to the message box text. If the string is any other value, the Cancel button is removed and the text is appended to the message box text.
To hide the Ignore button and remap its functionality
Add the following registry key:
[HKEY_LOCAL_MACHINE\SYSTEM\GWE\MsgBox] "NoIgnoreText"="\nThis text shows on a different line than the message text."
Set the value of
NoIgnoreText
to a string.NoIgnoreText
is a REG_SZ value. If the registry key is not present or is a zero-length string, the Ignore button appears as usual. If the string is a single blank, the Ignore button is removed, but no text is added to the message box text. If the string is any other value, the Ignore button is removed and the text is appended to the message box text.
To display the appended text on a new line, include a new-line character, \n, in the registry text. To add a new line to the registry from the build environment's registry file — for example, Platform.reg — use a double backslash: \\n.
These registry settings are usually set by the OEM for a particular language and are not changed. If they are changed, you must reboot the target device for the changes to take effect.
See Also
Customizing Dialog Boxes and Message Boxes
Send Feedback on this topic to the authors