GetObject
In Reflection 2011, GetObject calls can only support one type of legacy object, based on your Legacy API preference. For example, if you want GetObject to return the EXTRA! session object instead of the legacy Reflection session object, you will need to specify EXTRA! as the preferred API type in the Legacy API preference. For more information, see the Reflection 2011 Help.
Note: This sample code is intended to illustrate a concept, and it shows only the code that is relevant to that concept. It may not meet the security requirements for a specific environment, and it should not be used exactly as shown. We recommend that you add security and error-handling code to make your projects more secure and robust. Attachmate provides this sample code "AS IS" with no warranties.
- In this example, GetObject attaches to a running instance of Reflection 2011 by using the Automation server name (the default AutomationServerName value "Reflection Workspace"). This technique allows you to identify a particular Reflection 2011 instance even if multiple Reflection 2011 instances are active.
Dim ApplicationObject As Attachmate_Reflection_Objects_Framework.ApplicationObject
Set ApplicationObject = GetObject("Reflection Workspace")
ApplicationObject.CreateControl("C:\Users\[Username]\Documents\Attachmate\Reflection\MySession.rd5x")
- In this second example, GetObject attaches to a running instance of Reflection 2011. The comma after GetObject indicates that the first argument has been omitted. The line continuation character, an underscore preceded by a space, is used to break up the long line of code.
Dim App As Attachmate_Reflection_Objects_Framework.ApplicationObject
Set App = GetObject(, _ "Attachmate_Reflection_Objects_Framework.ApplicationObject")
- In this last example, GetObject opens a new instance of Reflection 2011 by returning a reference to the ApplicationObject object. The first argument includes an empty string. The line continuation character, an underscore preceded by a space, is used to break up the long line of code.
Dim App As Attachmate_Reflection_Objects_Framework.ApplicationObject
Set App = GetObject("", _ "Attachmate_Reflection_Objects_Framework.ApplicationObject")
|