Package.GetAutomationObject Method
Gets the automation object for the VSPackage.
Namespace: Microsoft.VisualStudio.Shell
Assembly: Microsoft.VisualStudio.Shell (in Microsoft.VisualStudio.Shell.dll)
Syntax
'宣言
Protected Overridable Function GetAutomationObject ( _
name As String _
) As Object
'使用
Dim name As String
Dim returnValue As Object
returnValue = Me.GetAutomationObject(name)
protected virtual Object GetAutomationObject(
string name
)
protected:
virtual Object^ GetAutomationObject(
String^ name
)
protected function GetAutomationObject(
name : String
) : Object
Parameters
name
Type: System.StringThe name of the automation object to return. If name is a null reference (Nothing in Visual Basic), GetAutomationObject returns the default automation object for the VSPackage.
Return Value
Type: System.Object
An instance of the automation object, or a null reference (Nothing in Visual Basic) if no automation support is available.
Exceptions
Exception | Condition |
---|---|
NotImplementedException | Thrown by the base implementation of GetAutomationObject. |
Remarks
Override GetAutomationObject when your VSPackage extends the DTE Automation object model.
The GetAutomationObject method returns a null reference (Nothing in Visual Basic) if name is a null reference (Nothing in Visual Basic), indicating there is no default automation object. (This causes the IVsPackage implementation to return E_NOTIMPL.)
If name is not a null reference (Nothing in Visual Basic), this method searches through the available metadata attributes for an option page with a name that matches the format <Category>.<Name>. If the option page has such a name and indicates that it supports automation, the automation object in the option page is returned.
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.
See Also
Concepts
Extending the Visual Studio Environment