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!

VB.NET problem with Extra X-treme under Win7 - Sessions.count

Status
Not open for further replies.

CybermanT

Programmer
Mar 9, 2011
1
FR
Hi,

I converted a very old VB6 program to VB.NET (VS2008) and it worked fine under WinXP Prof. x86.

Now, under Win7 Enterprise x86, running the same program, the behaviour is completely different.

I'm using Attachmate Extra! X-treme 9.1.

The following code was used in my program (I referenced the Attachmate 9.1 object library in the project) to check if an Extra session / Extra is already open. If this is the case and more than one session is open the user can choose which session to use with the program. Otherwise the user will be informed to open Extra upfront:

Module Module1
Public exSystem As EXTRA.ExtraSystem
Public exSession As EXTRA.ExtraSession
Public exSessions As EXTRA.ExtraSessions
Public ChoosenSession As Long

Public Sub CheckMultipleSessions()
exSystem = Nothing
exSession = Nothing
exSessions = Nothing

exSystem = New EXTRA.ExtraSystem
exSessions = DirectCast(exSystem.Sessions, EXTRA.ExtraSessions)

If exSessions.Count > 1 Then
ChoosenSession = 0
'frmSessions.ShowDialog()
exSession = DirectCast(exSessions.Item(ChoosenSession + 1), EXTRA.ExtraSession)
Else
exSession = DirectCast(exSessions.Item(0), EXTRA.ExtraSession)
End If
exSession.Activate()
End Sub
End Module

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
exSystem = New EXTRA.ExtraSystem
exSession = DirectCast(exSystem.ActiveSession, EXTRA.ExtraSession)
Catch
'Nothing
End Try
If exSession Is Nothing Then
hinweis = MessageBox.Show("Please start your Extra-Session and log in!" & Chr(13) & "After that click OK. You can exit the program by pressing Cancel", "Advice", MessageBoxButtons.OKCancel, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)
If hinweis = Windows.Forms.DialogResult.OK Then
Call Form1_Load(Me, New System.EventArgs())
Exit Sub
Else
End 'Exit program
End If
Else
'Session found
End If

Call CheckMultipleSessions()
End Sub
End Class

Earlier under XP that worked fine, if no session was open the user got a popup and that's it, if there were open sessions and more than one, the user could choose which session to use.

Under Win7 even if there is no session open, the exSessions.Count always returns 2 due to the fact that the lines
exSystem = New EXTRA.ExtraSystem
exSessions = DirectCast(exSystem.Sessions, EXTRA.ExtraSessions)
seem to open Extra sessions in the background. If I check the task manager I can see two times EXTRA.exe.

How can I get this working again under Win7?

 
You arecreating second session in
Public Sub CheckMultipleSessions()

by this statemant

exSystem = New EXTRA.ExtraSystem

even that you set exSystem to nothing , the process still runs.

remove thos lines from Public Sub CheckMultipleSessions()
and it should work

exSystem = Nothing
exSession = Nothing
exSessions = Nothing
exSystem = New EXTRA.ExtraSystem
exSessions = DirectCast(exSystem.Sessions, EXTRA.ExtraSessions)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top