Having downloaded the files you may wish to write a simple application to see the UPDD API interface in action.
The following code segment shows the skeleton of a simple C++ fragment that demonstrates:-
1. initialising the API
2. registering a callback routine to receive raw X/Y co-ordinates and notification of driver unload
3. shutting down
A .net c# user reported the following was required to run the API in C#
Import the functions from TBAPI.DLL using the DllImport command
Then for each function, such as this example, (on a Windows system)
void TBAPI TBApiInit(const TBCHAR* aSettingsPath);
where TBAPI = _stdcall
and TBCHAR = char
Use mangled reference names DLL_TBApiInit - use a utility like dumpbin to identify the mangled entry names to avoid entry point errors such as ‘Unable to find an entry point named 'TBApiInit' in DLL 'C:\Program Files\UPDD\TBAPI.dll'.
With the exception of Windows CE, which is Unicode only, the UPDD API is MBCS based only. Including the tbapi.h file in a Unicode program causes the Unicode definitions (intended for Windows CE) to be activated.
This can be avoided as follows.
4.1.10 and above
The API uses MBCS in the public interface all environments except Windows CE, where Unicode must be used. An error in the previous implementation meant that tbapi.h could not be used directly in a Unicode based program. This is no longer the case and previous partial solutions (such as “undef’ing” _UNICODE) are no longer required.
Under CE you need to pass UNICODE, so for example, the TBApiInit call is coded as:
The UPDD settings file is usually located in the UPDD application folder. When writing an application using the UPDD API then at the time the TBApiInit function is called the current working directory must be set to the folder containing the settings file. One way to achieve this is might be to run the program from the updd application folder.
The nature of the registered callback determines the type of data returned in a PointerData structure (although not all events are accompanied by additional data).
It is important that applications are aware if the driver is no longer available. This can be as a result of:-
1. The driver is being un-installed
To receive notification of these ‘unload’ events applications should register interest via TBApiRegisterDataCallback supplying the _ReadDataTypeUnload parameter.
UPDD version 4.1.10 introduces a number of changes to resolve problems reported with previous API implementations.
API programs written for earlier versions must be rebuilt and minor changes are required.
The requirement to set the working directory before calling TBApiInit no longer applies.
A change must be made to the call to TBApiInit to determine the desired method to locate the UPDD settings.
1) Using the “usual default” location.
This approach uses the default installation path used in most cases.
Unless your installation is manually installed to a nonstandard location or you are writing advanced code to work with pre-installation settings during an installation, this approach should suffice.
2) Using an explicit path
TBApiInit(“c:\\program files\\updd\\unusual location”);
3) Using a NULL argument to force the same behaviour as used in previous 4.x version
For further information or technical assistance please email the technical support team at firstname.lastname@example.org.