
Advanced Features 5-7
5.2 Terminal window
The MintMT ActiveX control has a number of secondary components that work with the MintController
object. One of these is the MintTerminal object. This is a window which will display any ASCII output from
the controller and allow ASCII input to the controller.
The form must have a MintController object for the terminal window to function. All communications to and
from a controller pass through the MintController object. In order for the terminal window to function it
must be linked to a specific controller. Once this link has been established all ASCII text from the
controller will be displayed in this window and all key presses performed in the window will be sent to the
controller as ASCII text.
Assuming the application already has a MintController object that can be used to communicate with a
controller, the ID of this controller object must be passed to the terminal window to create a link.
The ID of the MintController object can be obtained using the function getID.
This value can then be used to link the terminal window to a controller using the function
setMintControllerID.
The below example is written in Microsoft Visual C++ (m_controller is the name of the MintController object
in the project and m_terminal is the name of the MintTerminal object in the project).
// create handle to controller
m_controller.setNextMovePCI1Link ( 0, 0 );
// get ID of controller object
BSTR bstrID = m_controller.getID ();
// link the terminal window to the controller
m_terminal.setMintControllerID ( bstrID );
// clear up
::SysFreeString ( bstrID );
Notice the clean up section at the bottom that allows the re-use of memory used by the BSTR. Attempting
to perform the code in one line, for example:
m_terminal.setMintControllerID ( m_controller.getID () );
will result in a memory leak, as the BSTR will go out of scope before it can be freed.
The example below is written in Microsoft Visual Basic (MintController is the name of the MintController
object in the project and MintTerminal is the name of the MintTerminal object in the project).
Dim sID As String
‘ create handle to controller
MintController.setNextMovePCI1Link 0, 0
‘ get ID of controller object
sID = MintController.getID
‘ link the terminal window to the controller
MintTerminal.setMintControllerID sID
Comentarios a estos manuales