Hi,
I'm using vb.net 2010 with Robot RSA 2011 sp6 and 2012 sp5
I've got a crash on exiting Robot when my programm exit or when I call closeRobot like that :
Public Shared gRobotApplication As RobotOM.RobotApplication = New RobotOM.RobotApplication()
Private Shared gProjet As RobotOM.RobotProject = Nothing
Public Shared Sub closeRobot()
If gProjet IsNot Nothing Then
gProjet.Close()
gProjet = Nothing
End If
If gRobotApplication IsNot Nothing Then
gRobotApplication.Quit(IRobotQuitOption.I_QO_DISCARD_CHANGES)
gRobotApplication = Nothing
End If
End Sub
Solved! Go to Solution.
Solved by d.robin. Go to Solution.
Have you tried by using interfaces:
Public Shared gRobotApplication As RobotOM.IRobotApplication = New RobotOM.IRobotApplication()
Private Shared gProjet As RobotOM.IRobotProject = Nothing
Hi,
thx
it doesn't works... error :
Impossible d'effectuer un cast d'un objet COM de type 'System.__ComObject' en type d'interface 'RobotOM.IRobotApplication'. Cette opération a échoué, car l'appel QueryInterface sur le composant COM pour l'interface avec l'IID '{F787078F-CDE5-11D1-8FF1-00A02447BAAE}' a échoué en raison de l'erreur suivante : Cette interface n’est pas prise en charge (Exception de HRESULT : 0x80004002 (E_NOINTERFACE)).
You're right. My answer was wrong.
Have you set reference to RobotOM?
I've tested this code and works for me:
Public Class Form1 Public Shared gRobotApplication As RobotOM.RobotApplication = New RobotOM.RobotApplication() Private Shared gProjet As RobotOM.RobotProject = Nothing Public Shared Sub closeRobot() If gProjet IsNot Nothing Then gProjet.Close() gProjet = Nothing End If If gRobotApplication IsNot Nothing Then gRobotApplication.Quit(RobotOM.IRobotQuitOption.I_QO_DISCARD_CHANGES) gRobotApplication = Nothing End If End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click closeRobot() End Sub End Class
I use C#, I'm not so much used to VB.NET ...