-
-
Save clope031/65a41e88c990729d4d745244a94203c7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Imports ORiN2.interop.CAO | |
Public Class Task | |
Dim g_eng As CaoEngine | |
Dim g_ctrl As CaoController | |
Dim g_task As CaoTask | |
Private Sub Command1_Click(sender As System.Object, e As System.EventArgs) Handles Command1.Click | |
g_task.Start(1, "") 'Start Task | |
End Sub | |
Private Sub Command2_Click(sender As System.Object, e As System.EventArgs) Handles Command2.Click | |
g_task.Stop(4, "") 'Stop Task | |
End Sub | |
Private Sub Task_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load | |
g_eng = New CaoEngine | |
'Connect RC: IP setting depends on your RC setting. | |
g_ctrl = g_eng.Workspaces.Item(0).AddController("RC8", "caoProv.DENSO.RC8", "", "Server=192.168.0.1") | |
g_task = g_ctrl.AddTask("PRO1", "") 'Task Name PRO1 | |
End Sub | |
Private Sub Task_FormClosed(sender As System.Object, e As System.Windows.Forms.FormClosedEventArgs) Handles MyBase.FormClosed | |
'Delete task object | |
g_ctrl.Tasks.Clear() | |
System.Runtime.InteropServices.Marshal.ReleaseComObject(g_task) | |
g_task = Nothing | |
'Delete controller object | |
g_eng.Workspaces.Item(0).Controllers.Remove(g_ctrl.Index) | |
System.Runtime.InteropServices.Marshal.ReleaseComObject(g_ctrl) | |
g_ctrl = Nothing | |
'Delete engine object | |
System.Runtime.InteropServices.Marshal.ReleaseComObject(g_eng) | |
g_eng = Nothing | |
End Sub | |
End Class |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment