GetGlobalInstance Method
Collapse the table of content
Expand the table of content

IVsaSite.GetGlobalInstance Method

Gets a reference to a global item, such as the host-provided application object.

[Visual Basic]
Function GetGlobalInstance( _
   ByVal name As String _
) As Object
object GetGlobalInstance(
   string name
Object* GetGlobalInstance(
   String* name
function GetGlobalInstance(
   name : String
) : Object;


The specified name of the global object to retrieve.

Return Value

Returns a reference to the global object.


Exposing global objects in Script for the .NET Framework is a relatively simple process.

  1. The host adds global items to the engine by creating an IVsaGlobalItem object, specifying the name and type of the global object.
  2. With this information, the engine is able to compile the code items to bind against the global object.
  3. When the host calls the IVsaEngine.Run method, the engine calls back on the IVsaSite.GetGlobalInstance method to pull a host-provided instance of the named global item into the script engine.

The following table shows the exceptions that the GetGlobalInstance method can throw.

Exception Type Condition
GlobalInstanceInvalid The named global instance does not exist.
CallbackUnexpected The host was not expecting a call at this time.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

IVsaSite Interface | IVsaSite Members | Microsoft.Vsa Namespace | IVsaGlobalItem | IVsaEngine.Run

© 2016 Microsoft