[Expand]General Information/viewarticle/88628/
 [Expand]Using Help System/viewarticle/81465/
 [Expand]Getting Started Tutorial/viewarticle/82003/
 [Expand]Using TestComplete/viewarticle/84431/
 [Expand]Testing Types/viewarticle/85355/
 [Expand]Applications Testing/viewarticle/83383/
 [Expand]Working With Application Objects and Controls/viewarticle/81481/
 [Expand]Samples and Tutorials/viewarticle/81997/
  [Expand]Test Objects/viewarticle/82423/
  [Collapse]Scripting Objects/viewarticle/88052/
      List of Built-In Routines/viewarticle/80612/
      CallMethod Method/viewarticle/88508/
      CopyFiles Method/viewarticle/84315/
      CreateVariantArray Method/viewarticle/86938/
      CreateVariantArray2 Method/viewarticle/86872/
      CreateVariantArray3 Method/viewarticle/82567/
      Delay Method/viewarticle/80588/
      EnumEvents Method/viewarticle/80681/
      EnumFields Method/viewarticle/82815/
      EnumMethods Method/viewarticle/80670/
      EnumProperties Method/viewarticle/80684/
      GetCOMServerPath Method/viewarticle/87354/
      GetCSVCount Method/viewarticle/85083/
      GetCSVItem Method/viewarticle/83092/
      GetListCount Method/viewarticle/88617/
      GetListItem Method/viewarticle/84888/
      GetOrd Method/viewarticle/80795/
      GetValue Method/viewarticle/83922/
      InputBox Method/viewarticle/87589/
      InputQuery Method/viewarticle/83051/
      IsLanguageSupported Method/viewarticle/87594/
      IsPluginInstalled Method/viewarticle/80594/
      IsSupported Method/viewarticle/84909/
      Log Method/viewarticle/80868/
      MessageDlg Method/viewarticle/87123/
      ParamCount Method/viewarticle/82751/
      ParamStr Method/viewarticle/82421/
      RaiseEvent Method/viewarticle/83035/
      RebootAndContinue Method/viewarticle/80637/
      RemoveFolders Method/viewarticle/88227/
      SaveStrToFile Method/viewarticle/80697/
      SendMail Method/viewarticle/82076/
      SendMAPIMail Method/viewarticle/87243/
      SetKeyboardLayout Method/viewarticle/80601/
      SetValue Method/viewarticle/86854/
      ShowMessage Method/viewarticle/83039/
      StrContains Method/viewarticle/80866/
      StrEndsWith Method/viewarticle/80865/
      StrMatches Method/viewarticle/80869/
      StrStartsWith Method/viewarticle/80871/
      VarArrayHighBound Method/viewarticle/86740/
      VarArrayLowBound Method/viewarticle/88033/
      VarArrayRedim Method/viewarticle/88872/
      VarClear Method/viewarticle/83513/
      VarToBool, VarToFloat, VarToInteger, VarToString, VarToWString Methods/viewarticle/84826/
      VarToStr Method/viewarticle/85572/
      VarType Method/viewarticle/83161/
   [Expand]Obsolete Objects
  [Expand]Project and Project Item Objects/viewarticle/84209/
  [Expand]TestComplete Events/viewarticle/83126/
  [Expand]Language Reference/viewarticle/87902/
  [Expand]User Form Components/viewarticle/83917/
   Regular Expressions Syntax/viewarticle/81060/
 [Expand]Other Tools That Help You Test Better/viewarticle/82893/
 [Expand]TestComplete Licensing Guide/viewarticle/88365/
Updated: 10/12/2016 Applies To: TestComplete 12 Rating: No votes Click to rate: PoorNot badAverageGoodExcellent
Programming Reference

MessageDlg Method


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



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:


The method has the following parameters:


The message to be displayed.


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.


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.


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  


The following code demonstrates calling the MessageDlg function in scripts:

JavaScript, JScript

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


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


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


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

C++Script, C#Script

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

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