Share via


IOleComponentUIManager.ShowMessage Method

Definition

Requests the display of a modal message.

public:
 int ShowMessage(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 ShowMessage (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 ShowMessage : 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 ShowMessage (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] Role of the VSPackage object that is requesting the modal message display. For a list of valid dwCompRole values, see OLEROLE.

rclsidComp
Guid

[in] Class identifier (CLSID) of the VSPackage object requesting the message display.

pszTitle
String

[in] Pointer to the message text header or null if there is no header to display.

pszText
String

[in] Pointer to the main part of the message text or null if there is no text to display.

pszHelpFile
String

[in] Pointer to the path to a Help file.

dwHelpContextID
UInt32

[in] Specifies the Help context identifier.

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 ShowMessage succeeds, pnResult is set to one of the following menu item values returned by the dialog box:[1|1] Value[1|2] Description[2|1] IDABORT[2|2] Abort button was clicked.[3|1] IDCANCEL[3|2] Cancel button was clicked or the ESC key was pressed. If the message box does not have a Cancel button, pressing the ESC key has no effect. [4|1] IDIGNORE[4|2] Ignore button was clicked.[5|1] IDNO[5|2] No button was clicked.[6|1] IDOK[6|2] OK button was clicked.[7|1] IDRETRY[7|2] Retry button was clicked.[8|1] IDYES[8|2] 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 oleipc.idl:

HRESULT IOleComponentUIManager::ShowMessage(  
   [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  
);  

The title to the message box is composed of two strings: a message header and a message body.

The SOleComponentUIManager service notifies VSPackage objects registered with both this service and the SOleComponentManager service of the change to a modal state.

If the Warnings Off state is in effect, the SOleComponentUIManager service automatically inhibits the display of warning messages. However, if the message is informational or critical, it is always displayed even if the Warnings Off state is in effect.

Before displaying the message requested by an object acting as a subcomponent or a component control, the SOleComponentUIManager service gives the main component a chance to override any aspect of the message by calling its GetCntrMessage. The main VSPackage object can override the HelpFile, HelpContext, message text, or the message type.

Applies to