Reflection
CreateApplication(String,Boolean) Method
Example 


The name of the application instance. This is the unique application instance name reachable by .Net API programs. The channel name must have the same format as a valid Internet hostname. Names can contain only the ASCII letters 'a' through 'z' (in a case-insensitive manner), the digits '0' through '9', and the hyphen ('-'). No other symbols, punctuation characters, or white space are permitted. If the channelName is empty or null, a default name is generated and used.
The Boolean value that indicates whether a new instance of a Reflection application is visible. (This value does not change the visibilty of existing instances of the Reflection application.)
Creates an application that represents the instance of MyReflection running at the specified IPC channel. If the Reflection application instance is running at the specified channel, that instance is used.

If there is no Reflection application instance running at the specified channel and the Reflection Workspace "API Settings" .Net API option is enabled, a new instance of Reflection Workspace is started.

Syntax
'Declaration
 
Public Overloads Shared Function CreateApplication( _
   ByVal channelName As String, _
   ByVal visible As Boolean _
) As Application
'Usage
 
Dim channelName As String
Dim visible As Boolean
Dim value As Application
 
value = MyReflection.CreateApplication(channelName, visible)
public static Application CreateApplication( 
   string channelName,
   bool visible
)

Parameters

channelName
The name of the application instance. This is the unique application instance name reachable by .Net API programs. The channel name must have the same format as a valid Internet hostname. Names can contain only the ASCII letters 'a' through 'z' (in a case-insensitive manner), the digits '0' through '9', and the hyphen ('-'). No other symbols, punctuation characters, or white space are permitted. If the channelName is empty or null, a default name is generated and used.
visible
The Boolean value that indicates whether a new instance of a Reflection application is visible. (This value does not change the visibilty of existing instances of the Reflection application.)

Return Value

An Application object.
Example
This sample gets the instance of Reflectionrunning at the given channel name. If no instance is running at that channel name, it creates an instance. Then it creates a terminal control and connects to a host.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Attachmate.Reflection.Framework;
using Attachmate.Reflection.Emulation.IbmHosts;
using Attachmate.Reflection.UserInterface;
using System.Drawing;

namespace CreateApplicationAndStartInstance
{

    class MyApplication
    {


        static void Main(string[] args)
        {

            //Start a visible instance of Reflection or get the instance running at the given channel name
            Application app = MyReflection.CreateApplication("myReflection", true);

            //Create a terminal from the session document file
            string sessionPath = Environment.GetEnvironmentVariable("USERPROFILE") + @"\Documents\Micro Focus\Reflection\demoSession.rd3x";
            IIbmTerminal terminal = (IIbmTerminal)app.CreateControl(sessionPath);

            //Perform actions such as getting text from the terminal screen, or changing terminal settings (such as the SSL/TLS version)
           
            //Save the session document file with the new settings.
            MyReflection.ActiveApplication.Close(ApplicationCloseOption.CloseAlwaysSave);
          
        }
    }
}
See Also