InfoConnect API Guide
Attachmate.Reflection.Framework Namespace / MyReflection Class / Start Method / Start(String) Method
The name of the application instance. This name must be unique among active application instances in order to be 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.
Example


In This Topic
    Start(String) Method
    In This Topic
    Starts and names a visible InfoConnect application instance when the InfoConnect Workspace "API Settings" .Net API option is enabled.
    Syntax
    'Declaration
     
    
    Public Overloads Shared Function Start( _
       ByVal channelName As String _
    ) As Guid
    'Usage
     
    
    Dim channelName As String
    Dim value As Guid
     
    value = MyReflection.Start(channelName)
    public static Guid Start( 
       string channelName
    )

    Parameters

    channelName
    The name of the application instance. This name must be unique among active application instances in order to be 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.

    Return Value

    InfoConnect instance ID.
    Remarks
    This method returns an instance ID of type Guid if the call is successful; otherwise an exception is thrown. The returned instance ID uniquely identifies the application instance and is used as an input parameter in ForceStop(Guid instanceId) to stop the instance. (Use the ForceStop() method only after the Close() method fails.)

    The channelName parameter can be any valid string. Use the same channelName string in CreateApplication(channelName) to create an Application object.

    If you are starting more than one instance of a workspace in the same .NET application (calling MyReflection.Start(String) more than once), use a unique channelName value for each workspace.

    If you are creating a workspace instance, closing it, and creating it again with the same channelName value, you must wait for .NET to close the channel or you may get a RemotingException exception ("The pipe is being closed"). This can take up to about half a minute.

    Example
    The following example shows how to start two new application instances with unique IPC channel names.
    using System;
    using System.Collections.Generic;
    using System.Text;
    using Attachmate.Reflection;
    using Attachmate.Reflection.Emulation.IbmHosts;
    using Attachmate.Reflection.Framework;
    using Attachmate.Reflection.UserInterface;
    using Attachmate.Reflection.Emulation.OpenSystems;
    namespace MultipleWorkSpaces
    {
        class Program
        {
            static void Main(string[] args)
            {
                //Start an visible instance of a workspace and get a handle to the instance running at the given channel name ("Workspace1") 
                MyReflection.Start("Workspace1");
                Application app1 = MyReflection.CreateApplication("WorkSpace1");
    
                //Create a new IBM Session
                IIbmTerminal terminal1 = (IIbmTerminal)app1.CreateControl(new Guid("{09E5A1B4-0BA6-4546-A27D-FE4762B7ACE1}"));
                terminal1.HostAddress = "demo:ibm3270.sim";
    
                //Create a View and then get a handle to the screen
                IFrame frame1 = (IFrame)app1.GetObject("Frame");
                frame1.CreateView(terminal1);
                IIbmScreen screen1 = terminal1.Screen;
    
                //Start a second visible instance of a workspace and get a handle to the instance running at the given channel name ("Workspace2")  
                MyReflection.Start("Workspace2");
                Application app2 = MyReflection.CreateApplication("WorkSpace2");
    
                //Open a session in the second workspace
                string sessionPath = Environment.GetEnvironmentVariable("USERPROFILE") + @"\Documents\Micro Focus\InfoConnect\demoSession.rdox";
                ITerminal terminal2 = (ITerminal)app2.CreateControl(sessionPath);
    
                //Create a View for the session in the second workspace, and then get a handle to the screen
                IFrame frame2 = (IFrame)app2.GetObject("Frame");
                frame2.CreateView(terminal2);
                IScreen screen2 = (IScreen)terminal2.Screen;
    
                //Get some text from each of the terminal screens in the two workspaces
                Console.WriteLine("IBM terminal text is" + screen1.GetText(1, 1, 20) + "and UNIX text is" + screen2.GetText(1, 1, screen2.DisplayRows, screen2.DisplayColumns));
    
                //Close the workspaces
                app1.Close(ApplicationCloseOption.CloseNoSave);
                app2.Close(ApplicationCloseOption.CloseNoSave);
            }
        }
    }
    
    
    
    
    See Also