CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2002
    Posts
    55

    How can I create two session objects?

    I'm having trouble creating two seperate sessions of WRQ Reflection for HP. My code for creating the first session works fine, but when I try to create the second session. I get errors like, Connection Type can't be changed.

    Code:
    Private Sub OpenSessionF1()
    Dim isFound As Integer
    
        Dim MyObjectF1 As Reflection1.Session
        Set MyObjectF1 = CreateObject("Reflection1.Session")
        MyObjectF1.Visible = True
        With Session  '<------------------------------------ I think my problem is here.
            .ConnectionType = "BEST-NETWORK"
            .ConnectionSettings = "Host 192.6.22.2"
            .Connect
            isFound = .WaitForString("MPE/iX", 0, rcAllowKeystrokes)
                If isFound = False Then .Disconnect
        End With
    End Sub
    
    
    Private Sub OpenSessionF2()
    Dim isFound As Integer
        Dim MyObjectF2 As Reflection1.Session
        Set MyObjectF2 = CreateObject("Reflection1.Session")
        MyObjectF2.Visible = True
        With Session '<---------------------------------------Same Name so Same Session ??
            .ConnectionType = "BEST-NETWORK"
            .ConnectionSettings = "Host 192.6.22.2"
            .Connect
            isFound = .WaitForString("MPE/iX", 0, rcAllowKeystrokes)
                If isFound = False Then .Disconnect
        End With
    End Sub
    How do I assign a variable to the Session?

  2. #2
    Join Date
    Aug 2003
    Location
    Sydney, Australia
    Posts
    1,901

    Re: How can I create two session objects?

    HAVE YOU TRIED CREATING A "NEW" OBJECT

    Code:
    Private Sub OpenSessionF1()
    Dim isFound As Integer
    
        Dim MyObjectF1 As NEW Reflection1.Session  <=======================
        Set MyObjectF1 = CreateObject("Reflection1.Session")
        MyObjectF1.Visible = True
        With Session  '<------------------------------------ I think my problem is here.
            .ConnectionType = "BEST-NETWORK"
            .ConnectionSettings = "Host 192.6.22.2"
            .Connect
            isFound = .WaitForString("MPE/iX", 0, rcAllowKeystrokes)
                If isFound = False Then .Disconnect
        End With
    End Sub
    
    
    Private Sub OpenSessionF2()
    Dim isFound As Integer
        Dim MyObjectF2 As NEW Reflection1.Session <=====================
        Set MyObjectF2 = CreateObject("Reflection1.Session")
        MyObjectF2.Visible = True
        With Session '<---------------------------------------Same Name so Same Session ??
            .ConnectionType = "BEST-NETWORK"
            .ConnectionSettings = "Host 192.6.22.2"
            .Connect
            isFound = .WaitForString("MPE/iX", 0, rcAllowKeystrokes)
                If isFound = False Then .Disconnect
        End With
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured