IVsAppCommandLine::GetOption Method (String^, Int32, String^)

 

Retrieves the command line switches.

Namespace:   Microsoft.VisualStudio.Shell.Interop
Assembly:  Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)

int GetOption(
	String^ pszOptionName,
	[OutAttribute] int% pfPresent,
	[OutAttribute] String^% pbstrOptionValue
)

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.

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.

Return to top
Show: