InfoConnect VBA Guide
Attachmate.Reflection.Objects.Framework Library / ApplicationObject Object / CreateControl2 Method

This method returns the appropriate terminal control for the GUID value that you pass to it. Each type of terminal has a unique GUID, as shown below.

Terminal Control GUID
Ibm 3270 {09E5A1B4-0BA6-4546-A27D-FE4762B7ACE1}
Ibm 5250 {AF03A446-F278-4624-B9EF-C896DF2CA1CA}
VT (Open Systems) {BE835A80-CAB2-40d2-AFC0-6848E486BF58}
Web {F1F058B1-0472-4095-A782-3D7333813AD0}
ALC {0327C7A7-820D-4F9F-8BD6-11E0398605F1}
UTS {C8ADCD4F-3DF8-4BCA-821B-995FEF8DAFEF}
T27 {2AB85541-5BE6-4BCB-8AF5-DA2848DBA28C}

See the table in the remarks for Guids to use for each type of control.
Example
In This Topic
    CreateControl2 Method
    In This Topic
    Creates a control by its GUID type.
    Syntax
    expression.CreateControl2( _
       ByVal controlTypeGuid As String _
    ) As Object
    where expression is a variable that represents a ApplicationObject Object

    Parameters

    controlTypeGuid

    This method returns the appropriate terminal control for the GUID value that you pass to it. Each type of terminal has a unique GUID, as shown below.

    Terminal Control GUID
    Ibm 3270 {09E5A1B4-0BA6-4546-A27D-FE4762B7ACE1}
    Ibm 5250 {AF03A446-F278-4624-B9EF-C896DF2CA1CA}
    VT (Open Systems) {BE835A80-CAB2-40d2-AFC0-6848E486BF58}
    Web {F1F058B1-0472-4095-A782-3D7333813AD0}
    ALC {0327C7A7-820D-4F9F-8BD6-11E0398605F1}
    UTS {C8ADCD4F-3DF8-4BCA-821B-995FEF8DAFEF}
    T27 {2AB85541-5BE6-4BCB-8AF5-DA2848DBA28C}

    See the table in the remarks for Guids to use for each type of control.

    Return Value

    A terminal control
    Remarks

    For more about using the CreateControl2 method, see:

    Dynamically Create a Session

    Create a Session From a Microsoft Excel Macro

    Using the InfoConnect Object Model

    Get Screen Data With an Excel Macro

     

    Use the following GUIDs

    Terminal Control GUID
    Ibm 3270 {09E5A1B4-0BA6-4546-A27D-FE4762B7ACE1}
    Ibm 5250 {AF03A446-F278-4624-B9EF-C896DF2CA1CA} 
    VT (Open Systems) {BE835A80-CAB2-40d2-AFC0-6848E486BF58}
    Web {F1F058B1-0472-4095-A782-3D7333813AD0}
    ALC {0327C7A7-820D-4F9F-8BD6-11E0398605F1}
    UTS {C8ADCD4F-3DF8-4BCA-821B-995FEF8DAFEF}
    T27 {2AB85541-5BE6-4BCB-8AF5-DA2848DBA28C}
    Example

    This sample shows how to use the CreateControl2 method to create a new terminal control and then connect the terminal to a host.

    Sub CreateInfoConnectIBMSession()
        'Declare application, terminal, and view object variables:
         Dim app As Attachmate_Reflection_Objects_Framework.ApplicationObject
         Dim terminal As Attachmate_Reflection_Objects_Emulation_IbmHosts.IbmTerminal
         Dim view As Attachmate_Reflection_Objects.view
          
         'Get a handle to the workspace
         Set app = GetObject("InfoConnect Workspace")
                      
         'Create an Ibm3270 control and set the host address
         Set terminal = app.CreateControl2("{09E5A1B4-0BA6-4546-A27D-FE4762B7ACE1}")
         terminal.HostAddress = "demo:ibm3270.sim"
         terminal.port = "623"
        
         'For an Ibm5250 control, use the following Guid:
         'Set terminal = app.CreateControl2("{AF03A446-F278-4624-B9EF-C896DF2CA1CA}" )
        
         'Create a view to display the session
         Set view = ThisFrame.CreateView(terminal)
        
     End Sub
    

     

    Sub CreateInfoConnectOpenSystemsSession()
        'Declare application, terminal, and view object variables:
        Dim app As Attachmate_Reflection_Objects_Framework.ApplicationObject
        Dim terminal As Attachmate_Reflection_Objects_Emulation_OpenSystems.Terminal
        Dim view As Attachmate_Reflection_Objects.View
         
        'Get a handle to the workspace
        Set app = GetObject("InfoConnect Workspace")
                     
        'Create an Open Systems control and set the host address
        Set terminal = app.CreateControl2("{BE835A80-CAB2-40d2-AFC0-6848E486BF58}")
        terminal.ConnectionSettingsTelnet.HostAddress = "yourHostName"
       
        'Create a view to display the session
        Set view = ThisFrame.CreateView(terminal)
       
    End Sub
         
    

     

    This example creates a session, waits a few seconds, and closes the session.
    Sub CreateAndCloseReflectionIBMSession()
        'Declare application, terminal, and view object variables:
        Dim app As Attachmate_Reflection_Objects_Framework.ApplicationObject
        Dim terminal As Attachmate_Reflection_Objects_Emulation_IbmHosts.IbmTerminal
        Dim view As Attachmate_Reflection_Objects.view
         
        'Get a handle to the workspace
        Set app = GetObject("InfoConnect Workspace")
                     
        'Create an Ibm3270 control and set the host address
        Set terminal = app.CreateControl2("{09E5A1B4-0BA6-4546-A27D-FE4762B7ACE1}")
        terminal.HostAddress = "demo:ibm3270.sim"
        terminal.port = "623"
       
        'For an Ibm5250 control, use the following Guid:
        'Set terminal = app.CreateControl2("{AF03A446-F278-4624-B9EF-C896DF2CA1CA}" )
       
        'Create a view to display the session
        Set view = ThisFrame.CreateView(terminal)
        
        'perform commands for your session...
        app.Wait (3000)
        
        'close the session without saving
        view.Close CloseOption_CloseNoSave
       
    End Sub
    See Also