IOleComponentUIManager.ShowMessage Method
Requests the display of a modal message.
Namespace: Microsoft.VisualStudio.Shell.Interop
Assembly: Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)
Syntax
'Dichiarazione
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, _
<OutAttribute> ByRef pnResult As Integer _
) As Integer
'Utilizzo
Dim instance As IOleComponentUIManager
Dim dwCompRole As UInteger
Dim rclsidComp As Guid
Dim pszTitle As String
Dim pszText As String
Dim pszHelpFile As String
Dim dwHelpContextID As UInteger
Dim msgbtn As OLEMSGBUTTON
Dim msgdefbtn As OLEMSGDEFBUTTON
Dim msgicon As OLEMSGICON
Dim fSysAlert As Integer
Dim pnResult As Integer
Dim returnValue As Integer
returnValue = instance.ShowMessage(dwCompRole, _
rclsidComp, pszTitle, pszText, pszHelpFile, _
dwHelpContextID, msgbtn, msgdefbtn, _
msgicon, fSysAlert, pnResult)
int ShowMessage(
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 ShowMessage(
[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 ShowMessage :
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 ShowMessage(
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: System.UInt32
[in] Role of the VSPackage object that is requesting the modal message display. For a list of valid dwCompRole values, see OLEROLE.
- rclsidComp
Type: System.Guid%
[in] Class identifier (CLSID) of the VSPackage object requesting the message display.
- pszTitle
Type: System.String
[in] Pointer to the message text header or null if there is no header to display.
- pszText
Type: System.String
[in] Pointer to the main part of the message text or null if there is no text to display.
- pszHelpFile
Type: System.String
[in] Pointer to the path to a Help file.
- dwHelpContextID
Type: System.UInt32
[in] Specifies the Help context identifier.
- 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.
- msgdefbtn
Type: Microsoft.VisualStudio.Shell.Interop.OLEMSGDEFBUTTON
[in] Specifies the default button for the message box. For a list of valid msgdefbtn values, see OLEMSGDEFBUTTON.
- msgicon
Type: Microsoft.VisualStudio.Shell.Interop.OLEMSGICON
[in] Specifies the icon and type of the message. For a list of valid msgicon values, see OLEMSGICON.
- fSysAlert
Type: System.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: System.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: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, pressing 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: System.Int32
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.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
IOleComponentUIManager Interface