TBApiSendMacro API Call



Sends data to the controller associated with the specified device using the UPDD macro language. Do not wait for response.


Device handle, macro to send and length of macro command.


0 = fail, 1 = OK.


For more details of the UPDD macro language, see the on-line UPDD documentation.


Visual C++ Declaration/example



Since UPDD 4.1.x USB macros are executed synchronously even if calling TBApiSendMacro

In practice TBApiSendMacro is now more or less obsolete, only retained for legacy reasons.

Use TBApiSendMacroSynchronous instead.


BOOL TBAPI TBApiSendMacro(HTBDEVICE aDeviceHandle, const TCHAR* aMacro);


// The following example sends "hello world" to the first controller on the system with a 1 second gap

// between words. aMacro is a null terminated string with a maximum length of 2046 bytes


HTBDEVICE device = TBApiGetRelativeDevice(0);

char macro[]="hello [WAIT 1000]world";

TBApiSendMacro(device, macro);


// The following example sets DTR then RTS high and waits 20 milliseconds:

HTBDEVICE device = TBApiGetRelativeDevice(0);

char macro[]="[DTR 1][RTS 1][WAIT 20]";

if (!TBApiSendMacro(device, macro))

            AfxMessageBox(“Failed to send macro”);


Visual Basic Declaration/example


Public Declare Function TBApiSendMacro Lib "TBapi" Alias "_DLL_TBApiSendMacro@8" (ByVal aDeviceHandle As Long, ByVal aMacro As String) As Long