Reflection .NET API
Attachmate.Reflection.Framework Assembly / Attachmate.Reflection.Framework Namespace / MyReflection Class / ForceStop Method
The application instance returned from the Start() method.
Example


In This Topic
    ForceStop Method
    In This Topic
    Forces the Reflection application instance that matches the instance ID to stop. Use this method only after the Close() method fails.
    Syntax
    'Declaration
     
    
    Public Shared Sub ForceStop( _
       ByVal instanceId As Guid _
    ) 
    'Usage
     
    
    Dim instanceId As Guid
     
    MyReflection.ForceStop(instanceId)
    public static void ForceStop( 
       Guid instanceId
    )

    Parameters

    instanceId
    The application instance returned from the Start() method.
    Exceptions
    ExceptionDescription
    There is no such application instance ID.
    Example
    This example shows how to force Reflection to close if the Close method fails.
    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
        {
            private Guid applicationInstanceId;
    
            static public Guid ApplicationInstanceId { get; set; }
    
            static void Main(string[] args)
            {
    
                ApplicationInstanceId = MyReflection.Start();
    
                Application app = MyReflection.CreateApplication();
    
                //Open sessions and perform tasks...
    
    
                //Close Reflection
                try
                {
                    app.Close(ApplicationCloseOption.CloseNoSave);
                }
                catch
                {
                    MyReflection.ForceStop(ApplicationInstanceId);
                }
    
    
                Console.ReadLine();
            }
        }
    }
    
    See Also