InfoConnect API Guide
Attachmate.Reflection.Framework Namespace / MyReflection Class / Start Method / Start(Boolean) Method
The Boolean value that indicates whether the Reflection application is visible.
Example


In This Topic
    Start(Boolean) Method
    In This Topic
    Starts a (visible or invisible) Reflection application instance when the Reflection Workspace "API Settings" .Net API option is enabled.
    Syntax
    'Declaration
     
    
    Public Overloads Shared Function Start( _
       ByVal visible As Boolean _
    ) As Guid
    'Usage
     
    
    Dim visible As Boolean
    Dim value As Guid
     
    value = MyReflection.Start(visible)
    public static Guid Start( 
       bool visible
    )

    Parameters

    visible
    The Boolean value that indicates whether the Reflection application is visible.

    Return Value

    Reflection 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 theForceStop()method only after theClose()method fails.)

    To create an application object for the first application instance you create, use CreateApplication("Reflection_yourUserID"). For example, if your user ID is "SmithJ", the channel name for the first application instance you created with Start(bool visible), would be "Reflection_SmithJ".

    If you need to create application objects for more than one application instance, use the overloaded version, Start(string channelName, bool visible), to create a known unique channelName for each application instance.

    Example
    The following example shows how to start a new, invisible application instance:
    using Attachmate.Reflection.Emulation.IbmHosts;
    using Attachmate.Reflection.Framework;
    using Attachmate.Reflection.UserInterface;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    
    namespace ApplicationInstanceID
    {
        class Program
        {
    
            static void Main(string[] args)
            {
                //Start an invisible workspace instance
                MyReflection.Start(false);
    
                //Create an application that represents the instance of the workspace that was just started or is running at the default IPC channel
                Application app = MyReflection.CreateApplication();
    
                //Create a terminal for an Ibm 3270 session
                IIbmTerminal terminal = (IIbmTerminal)app.CreateControl(new Guid("{09E5A1B4-0BA6-4546-A27D-FE4762B7ACE1}"));
    
                //Specify the host name or IP address and connect.
                terminal.HostAddress = "demo:ibm3270.sim";
                terminal.Port = 623;
                terminal.Connect();
    
                //Create a view for the session
                IFrame frame = (IFrame)app.GetObject("Frame");
                frame.CreateView(terminal);
    
                //Get a handle to the screen. Then wait until it is ready and get the maximum columns and rows
                IIbmScreen screen = terminal.Screen;
                screen.WaitForHostSettle(3000, 2000);
                int maxCols = screen.Columns;
                int maxRows = screen.Rows;
    
                //Get the text on the screen and write it to the Console.
                string text = screen.GetTextEx(1, 1, maxRows, maxCols, GetTextArea.Block, GetTextWrap.On, GetTextAttr.Any, GetTextFlags.None);
                Console.WriteLine(text);
    
                app.Close(ApplicationCloseOption.CloseNoSave);
    
    
                Console.ReadLine();
            }
        }
    }
    
    
    See Also