
Advanced Features 6-9
5. To use the MintMT ActiveX control to communicate with a controller a handle to the controller must
be created. This can be done when the form loads. Double click on the form, to open an editor
window with the cursor in the Form_Load function. Add the code:
Private Sub Form_Load()
' Create handle to controller
MintController.setNextMovePCI1Link 0, 0
End Sub
The above code will create a handle to a NextMove PCI controller, card number 0 and node number
0.
6. Add a command button to the form and double click on the button. This will open an editor window
with the cursor in the function that is called when the command button is clicked. Add the code:
Private Sub Command1_Click()
Dim bState As Boolean
' Read the state of the relay
bState = MintController.Relay(0)
' Invert the state of the relay
If bState = False Then
bState = True
Else
bState = False
End If
' Write the new relay state
MintController.Relay(0) = bState
End Sub
This code will read the state of the relay and invert it. Run the application, when the button is
pressed the relay will toggle.
Note: This example is installed by the PC developer libraries in the folder
\MintMT\Example\Host\VisualBasic
Comentarios a estos manuales