InfoConnect for Unisys
ActiveApplication Property

Gets the active InfoConnect .NET API Application object based on the last InfoConnect Workspace instance that was activated.
Public Shared ReadOnly Property ActiveApplication As Application
Dim value As Application
value = MyReflection.ActiveApplication
public static Application ActiveApplication {get;}

Property Value

A InfoConnect .NET API Application object (Workspace), or null.

This example shows how to get a handle to the application that has focus.
//This sample gets all of the unnamed terminal controls running in an instance of InfoConnect.
//Before you run this sample, make sure at least one session is running in a InfoConnect workspace. 
//If more than one instance of InfoConnect is running, the session must be running in the first instance that was started.
using System;
using System.Collections.Generic;
using System.Text;
using Attachmate.Reflection.Framework;
using Attachmate.Reflection.Emulation.IbmHosts;
using Attachmate.Reflection.Emulation.OpenSystems;

namespace ConnectToASession
    class Program
        static void Main(string[] args)
            //Get a handle to the first Application instance started manually.
            //For production code, use a try catch block here to handle a System Application Exception thrown
            //if the app isn't running.
            Application app = MyReflection.ActiveApplication;

            //Get all of the terminal controls that are not named
            object[] terminals = app.GetControlsByName("");

            //Check to make sure at least one session is running.
            if (terminals != null && terminals.Length > 0)
                //Find terminals based on terminal type and host address
                foreach (Object terminal in terminals)

                    if (terminal.ToString().Contains("Ibm")) 
                        IIbmTerminal terminalIBM = (IIbmTerminal)terminal;

                        //Find specific terminals based on host address
                        //Then get connection status, get text from the screen, or perform other tasks


                    if (terminal.ToString().Contains("OpenSystems"))
                        ITerminal terminalOS = (ITerminal)terminal;

                        IConnectionSettingsTelnet conn = terminalOS.ConnectionSettings as IConnectionSettingsTelnet;

                        if (conn != null)
                            Console.WriteLine(((terminalOS.ConnectionSettings as IConnectionSettingsTelnet).HostAddress));



See Also