IVsUIShell.ShowMessageBox Method

Manages implementation of a message box event.

Namespace:  Microsoft.VisualStudio.Shell.Interop
Assembly:  Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)

Syntax

'Declaration
Function ShowMessageBox ( _
    dwCompRole As UInteger, _
    ByRef rclsidComp As Guid, _
    pszTitle As String, _
    pszText As String, _
    pszHelpFile As String, _
    dwHelpContextID As UInteger, _
    msgbtn As OLEMSGBUTTON, _
    msgdefbtn As OLEMSGDEFBUTTON, _
    msgicon As OLEMSGICON, _
    fSysAlert As Integer, _
    <OutAttribute> ByRef pnResult As Integer _
) As Integer
int ShowMessageBox(
    uint dwCompRole,
    ref Guid rclsidComp,
    string pszTitle,
    string pszText,
    string pszHelpFile,
    uint dwHelpContextID,
    OLEMSGBUTTON msgbtn,
    OLEMSGDEFBUTTON msgdefbtn,
    OLEMSGICON msgicon,
    int fSysAlert,
    out int pnResult
)
int ShowMessageBox(
    [InAttribute] unsigned int dwCompRole, 
    [InAttribute] Guid% rclsidComp, 
    [InAttribute] String^ pszTitle, 
    [InAttribute] String^ pszText, 
    [InAttribute] String^ pszHelpFile, 
    [InAttribute] unsigned int dwHelpContextID, 
    [InAttribute] OLEMSGBUTTON msgbtn, 
    [InAttribute] OLEMSGDEFBUTTON msgdefbtn, 
    [InAttribute] OLEMSGICON msgicon, 
    [InAttribute] int fSysAlert, 
    [OutAttribute] int% pnResult
)
abstract ShowMessageBox : 
        dwCompRole:uint32 * 
        rclsidComp:Guid byref * 
        pszTitle:string * 
        pszText:string * 
        pszHelpFile:string * 
        dwHelpContextID:uint32 * 
        msgbtn:OLEMSGBUTTON * 
        msgdefbtn:OLEMSGDEFBUTTON * 
        msgicon:OLEMSGICON * 
        fSysAlert:int * 
        pnResult:int byref -> int
function ShowMessageBox(
    dwCompRole : uint, 
    rclsidComp : Guid, 
    pszTitle : String, 
    pszText : String, 
    pszHelpFile : String, 
    dwHelpContextID : uint, 
    msgbtn : OLEMSGBUTTON, 
    msgdefbtn : OLEMSGDEFBUTTON, 
    msgicon : OLEMSGICON, 
    fSysAlert : int, 
    pnResult : int
) : int

Parameters

  • dwCompRole
    Type: UInt32

    [in] Do not use.

  • rclsidComp
    Type: Guid%

    [in] Do not use.

  • pszTitle
    Type: String

    [in] Pointer to the title of the message box.

  • pszText
    Type: String

    [in] Pointer to the text of the message box.

  • pszHelpFile
    Type: String

    [in] F1 keyword that corresponds to a specific Help topic. For more information, see Unique F1 Keywords.

  • dwHelpContextID
    Type: UInt32

    [in] Pass in zero.

  • msgbtn
    Type: Microsoft.VisualStudio.Shell.Interop.OLEMSGBUTTON

    [in] Specifies the set of buttons to appear in the message box. This parameter is similar to the uType parameter of the Win32 MessageBox function in that it uses similar values with similar semantics. For a list of valid msgbtn values, see OLEMSGBUTTON.

    Note   OLEMSGBUTTON_YESALLNOCANCEL is not supported and returns the same result as OLEMSGBUTTON_OK.

  • fSysAlert
    Type: Int32

    [in] If true, this flag causes the MB_SYSTEMMODAL flag to be set when showing the message. If false, no system flag is set during the message display.

  • pnResult
    Type: Int32%

    [out] Specifies the result of the message display. If ShowMessageBox succeeds, pnResult is set to one of the following menu item values returned by the dialog box.

    Value

    Description

    IDABORT

    Abort button was clicked.

    IDCANCEL

    Cancel button was clicked or the ESC key was pressed. If the message box does not have a Cancel button, pressed the ESC key has no effect.

    IDIGNORE

    Ignore button was clicked.

    IDNO

    No button was clicked.

    IDOK

    OK button was clicked.

    IDRETRY

    Retry button was clicked.

    IDYES

    Yes button was clicked.

Return Value

Type: Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

COM Signature

From vsshell.idl:

HRESULT IVsUIShell::ShowMessageBox(
   [in] DWORD dwCompRole,
   [in] REFCLSID rclsidComp,
   [in] LPOLESTR pszTitle,
   [in] LPOLESTR pszText,
   [in] LPOLESTR pszHelpFile,
   [in] DWORD dwHelpContextID,
   [in] OLEMSGBUTTON msgbtn,
   [in] OLEMSGDEFBUTTON msgdefbtn,
   [in] OLEMSGICON msgicon,
   [in] BOOL fSysAlert,
   [out][retval] LONG *pnResult
);

If you are not using Microsoft Help 2.0 to provide Help topics, pass in a unique string containing your help file name and the context ID for the topic you want to reference in the following format:

Help file name:Context ID

.NET Framework Security

See Also

Reference

IVsUIShell Interface

Microsoft.VisualStudio.Shell.Interop Namespace