Message Boxes
MessageBox, the standard Windows CE function for displaying message boxes, works on the Smartphone with some limitations. Because of the limit of two buttons on the SoftKeyBar, message boxes are limited to one or two buttons. The supported flags are MB_OK, MB_OKCANCEL, MB_RETRYCANCEL, and MB_YESNO. Using the flags MB_ABORTRETRYIGNORE or MB_YESNOCANCEL, which would normally result in message boxes with three buttons, will cause MessageBox to fail. Figure 19-5 shows a typical message box.
Figure 19-5: A message box on the Smartphone
The message box in Figure 19-5 is created with the following line:
MessageBox (hWnd, TEXT("Do you want to delete the file?"), TEXT("Box Title"),
MB_OKCANCEL | MB_ICONEXCLAMATION);
The interesting thing about the message box is the bold text, Alert, that is not part of the text passed to the MessageBox function. The Smartphone places this text on the message box depending on the icon specified in the MessageBox call. The text displayed depends on the language settings of the phone and optionally the customization done by the service provider, but for a U.S. English phone, the text is
The message text is displayed in smaller text below the large, bold prompt text. The title text is displayed on the caption bar across the top of the screen.If the message box has OK as one of the options, the user can press the action button on the phone to return IDOK. For other button settings such as Yes/No or Retry/Cancel, the action button has no effect and the user has to press one of the two buttons associated with the MenuBar. If the user presses the Back button, the message box is dismissed and the function returns the negative response, either No for a Yes/No choice, Cancel for Yes/Cancel, or OK if the message box only has an OK button.