Download 2.3 Tracker Programming Interface

Transcript
Private
Dim
Dim
Dim
Dim
Dim
Sub StartMeas_Click()
x As Double
y As Double
z As Double
d As Double 'd is a dummy variable
b As Boolean
On Error goo error handler
ObjSync.MeasureStationaryPoint x, y, z, d, d, _
d, d, d, d, d, d, _
d, d, d, d, d, d, b
MsgBox (x & CStr(" , ") & y & CStr(" , ") & z)
Exit Sub
ErrorHandler:
MsgBox (Err.Description)
End Sub
If this command was an asynchronous call, it
would not be possible to display the result within
this function. A result display is performed in the
appropriate asynchronous answer handler.
For more details, refer to Sample 5 source code.
Implementing Asynchronous Commands
Visual Basic with 'IntelliSense' provides support
for the available functions of an interface with the
function parameters.
Add a button named InitAsync.
The command handler should be completed with
the following code:
Private Sub InitAsync_Click()
On Error goo error handler
ObjAsync.Initialize
Exit Sub
error handler:
MsgBox (Err.Description)
End Sub
In contrast to the synchronous initialize function,
this one does not stop at the Initialize() function,
Exit Sub is reached immediately. When tracker
initialization is done, a notification or event is
sent.
Catching Events and Messages
For asynchronous commands, the answers must
be handled by some event mechanism. This could
be Events, Windows Messages (custom windowbound, registered, WM_COPYDATA).
274