[Collapse]TestComplete/viewarticle/63445/
 [Expand]General Information/viewarticle/63445/
 [Expand]Using Help System/viewarticle/55799/
 [Expand]Getting Started Tutorial/viewarticle/56246/
 [Expand]Using TestComplete/viewarticle/57875/
 [Expand]Testing Types/viewarticle/62721/
 [Expand]Applications Testing/viewarticle/62606/
 [Expand]Working With Application Objects and Controls/viewarticle/55815/
 [Expand]Samples and Tutorials/viewarticle/56239/
 [Collapse]References/viewarticle/57878/
  [Expand]Test Objects/viewarticle/57881/
  [Collapse]Scripting Objects/viewarticle/57882/
   [Expand]A
   [Collapse]B
    [Expand]BDE/viewarticle/56909/
    [Collapse]BuiltIn/viewarticle/55043/
      List of Built-In Routines/viewarticle/55043/
      CallMethod Method/viewarticle/58356/
      CopyFiles Method/viewarticle/58360/
      CreateVariantArray Method/viewarticle/58149/
      CreateVariantArray2 Method/viewarticle/58146/
      CreateVariantArray3 Method/viewarticle/58147/
      Delay Method/viewarticle/55019/
      EnumEvents Method/viewarticle/55117/
      EnumFields Method/viewarticle/58401/
      EnumMethods Method/viewarticle/55115/
      EnumProperties Method/viewarticle/55122/
      GetCOMServerPath Method/viewarticle/58368/
      GetCSVCount Method/viewarticle/58369/
      GetCSVItem Method/viewarticle/58370/
      GetListCount Method/viewarticle/58371/
      GetListItem Method/viewarticle/58373/
      GetOrd Method/viewarticle/55235/
      GetValue Method/viewarticle/58375/
      InputBox Method/viewarticle/56544/
      InputQuery Method/viewarticle/58377/
      IsLanguageSupported Method/viewarticle/58397/
      IsPluginInstalled Method/viewarticle/55026/
      IsSupported Method/viewarticle/58175/
      Log Method/viewarticle/55326/
      MessageDlg Method/viewarticle/58378/
      ParamCount Method/viewarticle/56545/
      ParamStr Method/viewarticle/56546/
      RaiseEvent Method/viewarticle/58380/
      RebootAndContinue Method/viewarticle/55070/
      RemoveFolders Method/viewarticle/58382/
      SaveStrToFile Method/viewarticle/55132/
      SendMail Method/viewarticle/56307/
      SendMAPIMail Method/viewarticle/58386/
      SetKeyboardLayout Method/viewarticle/55033/
      SetValue Method/viewarticle/58387/
      ShowMessage Method/viewarticle/58376/
      StrContains Method/viewarticle/55320/
      StrEndsWith Method/viewarticle/55319/
      StrMatches Method/viewarticle/55323/
      StrStartsWith Method/viewarticle/55325/
      VarArrayHighBound Method/viewarticle/58148/
      VarArrayLowBound Method/viewarticle/58367/
      VarArrayRedim Method/viewarticle/58366/
      VarClear Method/viewarticle/58354/
      VarToBool, VarToFloat, VarToInteger, VarToString, VarToWString Methods/viewarticle/58352/
      VarToStr Method/viewarticle/58353/
      VarType Method/viewarticle/58355/
   [Expand]C
   [Expand]D
   [Expand]F
   [Expand]H
   [Expand]I
   [Expand]O
   [Expand]P
   [Expand]R
   [Expand]S
   [Expand]T
   [Expand]U
   [Expand]W
   [Expand]V
   [Expand]Obsolete Objects
  [Expand]Project and Project Item Objects/viewarticle/57880/
  [Expand]TestComplete Events/viewarticle/56945/
  [Expand]Language Reference/viewarticle/57879/
  [Expand]User Form Components/viewarticle/56689/
 [Expand]Other Tools That Help You Test Better/viewarticle/63442/
 [Expand]TestComplete Licensing Guide/viewarticle/63451/
Updated: 3/11/2014 Applies To: TestComplete 10 Rating: No votes Click to rate: PoorNot badAverageGoodExcellent
Programming Reference Select language for code samples Select language for code samples

MessageDlg Method

Description

The MessageDlg function displays a dialog box with the specified message and buttons.

Declaration

BuiltIn.MessageDlg(Param1Param2Param3Param4)

Param1 [in] Required String
Param2 [in] Required Integer
Param3 [in] Required Byte
Param4 [in] Required Integer
Result Integer  

Applies To

The method is applied to the following object:

Parameters

The method has the following parameters:

Param1

The message to be displayed.

Param2

Indicates the message box type. It can be any of the following constants:

Constant Description
mtWarning The message box will contain the exclamation point icon.
mtError The message box will contain the red stop icon.
mtInformation The message box will contain the information icon.
mtConfirmation The message box will contain the question mark icon.
mtCustom The message box will not contain any bitmap.

Param3

Specifies the buttons to be displayed in the message box. This parameter can be any combination of the following values:

Constant Description Constant Description
mbYes "Yes" button mbAll "All" button
mbNo "No" button mbYesToAll "Yes to All" button
mbOK "OK" button mbNoToAll "No to All" button
mbCancel "Cancel" button mbHelp "Help" button
mbAbort "Ignore" button mbYesNoCancel "Yes", "No" and "Cancel" buttons
mbRetry "Retry" button mbOKCancel "OK" and "Cancel" buttons
mbIgnore "Ignore" button mbAbortRetryIgnore "Abort", "Retry" and "Ignore" buttons

To specify the Param3 parameter, you should create a set value using the MkSet function (see the example below). Use of MkSet is obligatory. You are not allowed to skip it.

Param4

This parameter is reserved.

Result Value

The MessageDlg function returns one of the constants that indicates which button the user pressed in the message box:

mrYes mrAll mrYesToAll
mrNo mrAbort mrNoToAll
mrOK mrRetry  
mrCancel mrIgnore  

Example

The following code demonstrates calling the MessageDlg function in scripts:

VBScriptCopy Code

Sub TestDialog
  i = MkSet(mbYes, mbYesToAll, mbNo, mbCancel)
  i = MessageDlg("Message text", mtConfirmation, i, 0)
End Sub

JScriptCopy Code

function TestDialog()
{
  var i;
  i = MkSet(mbYes, mbYesToAll, mbNo, mbCancel);
  i = MessageDlg("Message text", mtConfirmation, i, 0);
}

DelphiScriptCopy Code

procedure TestDialog;
var
  i : OleVariant;
begin
  i := MkSet(mbYes, mbYesToAll, mbNo, mbCancel);
  i := MessageDlg('Message text', mtConfirmation, i, 0);
end;

C++Script, C#ScriptCopy Code

function TestDialog()
{
  var i;
  i = MkSet(mbYes, mbYesToAll, mbNo, mbCancel);
  i = MessageDlg("Message text", mtConfirmation, i, 0);
}

See also
InputBox Method | InputQuery Method | ShowMessage Method | MkSet Function


© 2014 SmartBear Software. All rights reserved.
Email Send feedback on this document