Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using VB6 to open a session

Status
Not open for further replies.

OmahaNebraska

Programmer
Aug 31, 2004
13
US
This thread 1-893756 show me how to open a session, but when I tried, it doesn't work.

Private Sub Command1_Click()

Dim Sessions As ExtraSessions
Dim session As ExtraSession
Dim strPath As String
Dim extraConn As ExtraConnectivity
Dim sysSession As New ExtraSystem
Dim screenHost As ExtraScreen
Dim waitobj As Object
Dim waitforKeys$
Dim wait1 As Object
Dim strPswrd As String
Dim strAccount As String

Set sysSession = CreateObject("Extra.system")

Set Sessions = sysSession.Sessions
Set session = Sessions.Open("C:\Program Files\Attachmate\Sessions\Apollo.ADP")
Set screenHost = session.Screen
DoEvents
session.WindowState = xNORMAL
DoEvents

End Sub

When I open, it has the error "Object Variable or with block variable not set" at this line:
Set session = Sessions.Open........

But when I open the session first then it works fine.

How do we use VB6 to open Attachmate and one of its sessions? (AccMgr32.exe).
Thanks,
Pal.
 
See the FAQ:

How do I use VB(A) to manipulate attachmate (6.5+)? faq99-4069

Are you sure that your path statement is correct? I also had to make the session visible after opening it.

I don't typically use VB to open Extra!. I have my users sign on to use any program. Most are signed on all day by default anyway.

calculus
 
For some reason, now I can't even get it working anymore.
I got the runtime error......

Can anyone help me out? I can open up the application (The InfoConnect Version 7.5a AccMgr32.exe)

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hwnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, _
ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Sub Command1_Click()

Dim success
Dim PauseTime
Dim Start




success = ShellExecute(0&, "Open", "C:\Program Files\Attachmate\INFOCNEE\Accmgr32\AccMgr32.exe", vbNullString, "C:\Program Files\Attachmate\INFOCNEE\Accmgr32", vbMinimizedFocus)



Set sysSession = CreateObject("Extra.system")

Set Sessions = sysSession.Sessions
'Set session = Sessions.Open("C:\Program Files\Attachmate\INFOCNEE\Sessions\ENU\Mainframe Demo Session.edp")
Set session = Sessions.Open("C:\Program Files\Attachmate\INFOCNEE\Sessions\Apollo.adp")
Set screenHost = session.Screen
DoEvents
session.WindowState = xNORMAL
DoEvents
session.Visible = True

End Sub

 
This is what I am using when initializing EXTRA from VB6.

Private Sub Form_Initialize()
Set System = CreateObject("EXTRA.System") ' Gets the system object
If (System Is Nothing) Then
MsgBox "Could not create the EXTRA System object. Stopping macro playback."
Stop
End If
Set Session = System.Sessions.Open("C:\Program Files\Attachmate\E!E2K\Sessions\ENU\jan.edp")

If (Session Is Nothing) Then
MsgBox "Could not create the Sessions collection object. Stopping macro playback."
Stop
End If

g_HostSettleTime = 300 ' milliseconds

OldSystemTimeout& = System.TimeoutValue
If (g_HostSettleTime > OldSystemTimeout) Then
System.TimeoutValue = g_HostSettleTime
End If

If Not Session.Visible Then Session.Visible = True
Session.Screen.waithostquiet (g_HostSettleTime)
Set myScreen = Session.Screen
End Sub


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top