HtmlMessageBox / Show

Top  Previous  Next

The HtmlMessageBox function (called Show in some interfaces) is the main function for showing MessageBoxes. It is a direct replacement for the standard Windows API MessageBox function.

 

Syntax:

 

 Standard Windows API Calling:

 int HtmlMessageBox(HWND parent, wchar_t *text, wchar_t *caption, UINT flags);

 

 COM Object Calling:

 LONG obj.Show(ULONG parent, BSTR text, BSTR caption, ULONG flags)

 

 .NET Object Calling (C# / VB.NET):

 int HtmlMsgBox.Show(int parent, String text, String caption, uint flags);

 

 PowerBuilder Calling:

 long obj.HtmlMsgBox(ulong parent, String text, String caption, ulong flags) // standard API

// OR, one of the following that replicate the standard PowerBuilder

// MessageBox calls, except for omitting the initial title parameter

integer obj.Show(String text)

integer obj.Show(String text, Icon aIcon)

integer obj.Show(String text, Icon aIcon, Button aButton)

integer obj.Show(String text, Icon aIcon, Button aButton, integer defaultButton)

 

 

Parameters:

 

parent: The window handle of the window that will be the parent of the MessageBox. If you pass 0, the current main window will be the parent, so that is probably always adequate.

 

text: The text (or HTML) string to display in the MessageBox.

 

caption: The text for the title bar of the MessageBox.

 

flags: See Flags and Return Values from HtmlMessageBox / Show.

 

PowerBuilder Show method parameters: Identical to those for the standard PowerBuilder MessageBox function, except for omitting its initial title parameter, which is supplied by the nvo_messagebox object's is_title instance variable. See the PowerBuilder documentation of the MessageBox function for details.

 

Return Value:

 

Returns a code indicating the button that was selected on the MessageBox. See Flags and Return Values from HtmlMessageBox / Show.

 

Remarks:

 

Most but not all flags from the standard Windows MessageBox API are supported.

 

Calling this function actually displays the MessageBox, with the text parameter displayed as HTML. The default font used, and whether newlines in the text are treated as breaks, can be modified by calls to HtmlMessageBoxSetDefaultFontFace, HtmlMessageBoxSetDefaultPointSize, and HtmlMessageBoxSetNewlineIsBreak.

 

 

Example:

 

For standard Windows API calling:

 

HtmlMessageBox(0, "Some <b>bold</b> and <i>italic</i> text.<BR><BR>Stuff after an empty line.",

 "Test MessageBox", 0);