共用方式為


IVsUIShell.ShowMessageBox Method

Definition

Manages implementation of a message box event.

public:
 int ShowMessageBox(System::UInt32 dwCompRole, Guid % rclsidComp, System::String ^ pszTitle, System::String ^ pszText, System::String ^ pszHelpFile, System::UInt32 dwHelpContextID, Microsoft::VisualStudio::Shell::Interop::OLEMSGBUTTON msgbtn, Microsoft::VisualStudio::Shell::Interop::OLEMSGDEFBUTTON msgdefbtn, Microsoft::VisualStudio::Shell::Interop::OLEMSGICON msgicon, int fSysAlert, [Runtime::InteropServices::Out] int % pnResult);
public int ShowMessageBox (uint dwCompRole, ref Guid rclsidComp, string pszTitle, string pszText, string pszHelpFile, uint dwHelpContextID, Microsoft.VisualStudio.Shell.Interop.OLEMSGBUTTON msgbtn, Microsoft.VisualStudio.Shell.Interop.OLEMSGDEFBUTTON msgdefbtn, Microsoft.VisualStudio.Shell.Interop.OLEMSGICON msgicon, int fSysAlert, out int pnResult);
abstract member ShowMessageBox : uint32 * Guid * string * string * string * uint32 * Microsoft.VisualStudio.Shell.Interop.OLEMSGBUTTON * Microsoft.VisualStudio.Shell.Interop.OLEMSGDEFBUTTON * Microsoft.VisualStudio.Shell.Interop.OLEMSGICON * int * int -> int
Public 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, ByRef pnResult As Integer) As Integer

Parameters

dwCompRole
UInt32

[in] Do not use.

rclsidComp
Guid

[in] Do not use.

pszTitle
String

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

pszText
String

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

pszHelpFile
String

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

dwHelpContextID
UInt32

[in] Pass in zero.

msgbtn
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.

msgdefbtn
OLEMSGDEFBUTTON

[in] Specifies the default button for the message box. For a list of valid msgdefbtn values, see OLEMSGDEFBUTTON.

msgicon
OLEMSGICON

[in] Specifies the icon and type of the message. For a list of valid msgicon values, see OLEMSGICON.

fSysAlert
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
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.ValueDescriptionIDABORT 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.IDNONo button was clicked.IDOK OK button was clicked.IDRETRY Retry button was clicked.IDYES Yes button was clicked.

Returns

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

Applies to