IVsAppCommandLine.GetOption Method
Retrieves the command line switches.
Namespace: Microsoft.VisualStudio.Shell.Interop
Assembly: Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)
Syntax
'Declaración
Function GetOption ( _
pszOptionName As String, _
<OutAttribute> ByRef pfPresent As Integer, _
<OutAttribute> ByRef pbstrOptionValue As String _
) As Integer
'Uso
Dim instance As IVsAppCommandLine
Dim pszOptionName As String
Dim pfPresent As Integer
Dim pbstrOptionValue As String
Dim returnValue As Integer
returnValue = instance.GetOption(pszOptionName, _
pfPresent, pbstrOptionValue)
int GetOption(
string pszOptionName,
out int pfPresent,
out string pbstrOptionValue
)
int GetOption(
[InAttribute] String^ pszOptionName,
[OutAttribute] int% pfPresent,
[OutAttribute] String^% pbstrOptionValue
)
function GetOption(
pszOptionName : String,
pfPresent : int,
pbstrOptionValue : String
) : int
Parameters
pszOptionName
Type: System.String[in] Command line switch name.
pfPresent
Type: System.Int32%[out] Flag indicating if user entered command line switch pszOptionName.
pbstrOptionValue
Type: System.String%[out] BSTR containing text the user entered as a parameter of the command line switch.
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 vsshell.idl:
HRESULT IVsAppCommandLine::GetOption(
[in] LPCOLESTR pszOptionName,
[out] BOOL* pfPresent,
[out, retval] BSTR* pbstrOptionValue
);
Call this method from SetSite Method each time your package is loaded. Examine pfPresent to determine if your command line switch was entered. Examine pbstrOptionValue to retrieve any text that was entered if your command line switch accepts arguments. For more information on implementing command line switches, see Adding Command Line Switches.
Permissions
- 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.