Delen via


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

'Declaration
Function GetOption ( _
    pszOptionName As String, _
    <OutAttribute> ByRef pfPresent As Integer, _
    <OutAttribute> ByRef pbstrOptionValue As String _
) As Integer
int GetOption(
    string pszOptionName,
    out int pfPresent,
    out string pbstrOptionValue
)
int GetOption(
    [InAttribute] String^ pszOptionName, 
    [OutAttribute] int% pfPresent, 
    [OutAttribute] String^% pbstrOptionValue
)
abstract GetOption : 
        pszOptionName:string * 
        pfPresent:int byref * 
        pbstrOptionValue:string byref -> int
function GetOption(
    pszOptionName : String, 
    pfPresent : int, 
    pbstrOptionValue : String
) : int

Parameters

  • pszOptionName
    Type: String

    [in] Command line switch name.

  • pfPresent
    Type: Int32%

    [out] Flag indicating if user entered command line switch pszOptionName.

  • pbstrOptionValue
    Type: String%

    [out] BSTR containing text the user entered as a parameter of the command line switch.

Return Value

Type: 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.

.NET Framework Security

See Also

Reference

IVsAppCommandLine Interface

Microsoft.VisualStudio.Shell.Interop Namespace