TBApiInit API and TBApiInitEx Call

 

Description

Initialises the API.

Also TBApiInitEx (5.0.2 onwards) which provides return code checking.

This api should be called once only, usually at the start of the program and before any other API functions.

TBApiTerminate must be called at the end of the program.

A program should not repeat TBApiInitEx / TBApiTerminate calls.

4.1.10

 

Paramaters

None or path to folder containing UPDD settings file.

Returns

Void (assumes UPDD driver is installed)

 

TBApiInitEx: BOOL: TRUE = ok and FALSE = failed. The caps are important.

Notes

Since UPDD version 4.1.10 the requirement to set the working directory before calling TBApiInit no longer applies. Options now exist to allow TBApiInit to determine the desired method to locate the UPDD settings.

 

1)    Using the “usual default” location.

char path[1024];

TBApiDefaultSettingsPath(path,sizeof(path));

TBApiInit(path);

 

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

TBApiInit(NULL);

 

5.1.x

 

Parameters

NULL - use the legacy TBApiInit behaviour

or <PATH TO FOLDER CONTAINING tbupdd.ini>

Returns

True / False

Notes

This api can be used in 3 ways.

 

1) In conjunction with TBApiDefaultSettingsPath to use

Win32, the installed location

Linux, /opt/tbupddlx

MAC, /Library/Application Support

Win CE \application data\updd

e.g.

TCHAR path[PATH_MAX];

TBApiDefaultSettingsPath(path,sizeof(path));

TBApiInitEx(path);

 

2) Using an explicit path NB do not include the file name

e.g.

TBApiInitEx(“c:\\unusual location”);

 

3) Pass NULL to use legacy behaviour

e.g.

TBApiInit(NULL);

 

 

 

 

Visual C++ Declaration/example

 

void TBAPI TBApiInitEx();

 

TBApiInitEx(TBApiDefaultSettingsPath());

 

Visual Basic Declaration/example

 

Public Declare Function TBApiInit Lib "TBapi" Alias "_DLL_TBApiInit@4" ()

 

TBApiInit