Programming with COM and Reflection Desktop, Reflection 2014, or Reflection 2011

  • 7021508
  • 14-Dec-2007
  • 18-Mar-2020

Environment

Reflection Desktop (including Pro, for X, for IBM, or for UNIX and OpenVMS) 16.0 or higher
Reflection 2014
Reflection Pro 2014
Reflection for IBM 2014
Reflection for UNIX and OpenVMS 2014
Reflection for IBM 2011
Reflection for UNIX and OpenVMS 2011
Reflection Standard Suite 2011

Situation

Your application may not support .NET technology to control Reflection Desktop 16, Reflection 2014, or Reflection 2011. This technical note provides information about using the alternative OLE Automation (COM) API and obtaining related programming reference documentation.

Resolution

When developing new applications to control Reflection Desktop 16, Reflection 2014, or Reflection 2011, .NET technology is recommended.

However, COM (Automation) is also supported, if you are using other applications that do not support .NET, such as Microsoft Office (for example, Excel macros), Visual Basic for Applications (VBA), or Microsoft Visual Basic 6.0 (VB6). Supported COM APIs include:

Note: In the Reflection 14.x Programming References, disregard the ActiveX Control topics. ActiveX is not supported in Reflection 2007 or higher.

Legacy COM Example

Assuming you have already added ReflectionCOM to your project References, here are a couple VBA code examples that call the COM API to open a visible IBM 5250 session in Reflection Desktop 16, Reflection 2014, or Reflection 2011.

'Open a new session from scratch, not based on a previous settings file
Sub OpenNewSession()
    Dim r As ReflectionCOM.Session
    Set r = CreateObject("ReflectionIBM.Session")
    r.SetupSession rc5250Terminal, rc31792, rcTelnet
    r.Hostname = "xxx.xxx.xxx.xxx"  'Replace with IP address or hostname
    r.Visible = True
    r.Connect
End Sub

'Open an existing settings file document...
Sub OpenPreviouslySaved()
    Dim r As ReflectionCOM.Session
    Set r = CreateObject("ReflectionIBM.Session")
    r.OpenSettings rcSettings, "C:\Users\lab\Documents\Attachmate\Reflection\sonic.rd5x"
    r.Visible = True
    'session previously saved with AutoConnect=true...
End Sub

For another example, see KB 7024460.

Additional Information

For additional programming resources, see KB 7022686.

Legacy KB ID

This document was originally published as Attachmate Technical Note 2271.

Feedback service temporarily unavailable. For content questions or problems, please contact Support.