IVsUIShell.ShowMessageBox 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
管理消息框事件的实现。
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
参数
- dwCompRole
- UInt32
中请勿使用。
- rclsidComp
- Guid
中请勿使用。
- pszTitle
- String
中指向消息框标题的指针。
- pszText
- String
中指向消息框文本的指针。
- pszHelpFile
- String
中对应于特定帮助主题的 F1 关键字。 有关详细信息,请参阅唯一的 F1 关键字。
- dwHelpContextID
- UInt32
中传入零。
- msgbtn
- OLEMSGBUTTON
中指定要在消息框中显示的按钮集。 此参数类似于函数的 uType 参数 Win32 MessageBox ,因为它使用具有类似语义的类似值。 有关有效值的列表 msgbtn ,请参阅 OLEMSGBUTTON 。
请注意 OLEMSGBUTTON_YESALLNOCANCEL 不受支持,并且返回与 OLEMSGBUTTON_OK 相同的结果。
- msgdefbtn
- OLEMSGDEFBUTTON
中指定消息框的默认按钮。 有关有效值的列表 msgdefbtn ,请参阅 OLEMSGDEFBUTTON 。
- msgicon
- OLEMSGICON
中指定消息的图标和类型。 有关有效值的列表 msgicon ,请参阅 OLEMSGICON 。
- fSysAlert
- Int32
中如果 true 为,则在显示消息时,此标志将导致 MB_SYSTEMMODAL 设置标志。 如果 false 为,则在显示消息时不设置任何系统标志。
- pnResult
- Int32
弄指定消息显示的结果。 如果 ShowMessageBox 成功, pnResult 则将设置为对话框返回的以下菜单项值之一。单击 "ValueDescriptionIDABORT 中止" 按钮。单击 "取消" 按钮或按下了 ESC 键 IDCANCEL。 如果消息框中没有 "取消" 按钮,则按 ESC 键不起作用。单击了 IDIGNORE 的 "忽略" 按钮。已单击 IDNONo 按钮。已单击 IDOK "确定" 按钮。单击 "IDRETRY 重试" 按钮。单击 "是" 按钮 IDYES。
返回
如果该方法成功,则它会返回 S_OK。 如果该方法失败,则会返回错误代码。
注解
COM 签名
从 vsshell:
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
);
如果未使用 Microsoft Help 2.0 提供帮助主题,请传入一个唯一字符串,该字符串包含你的帮助文件名称,以及你想要引用的主题的上下文 ID,格式如下:
帮助文件名:上下文 ID