TBApiEnumAdhocValues API Call

 

Description

This routine identifies ad hoc settings (if any) for the specified device and invokes a callback with the setting key(s) together with a string or doubleword value(s).

For more information, see the Ad hoc settings section.

Parameters

Device handle, address of callback routine and context identifier

Returns

None.

Notes

It is necessary to define a callback routine which will receive the Ad hoc key together with its string or doubleword value with a boolean indicating which datatype was returned.

 

Visual C++ Declaration/example

 

void TBAPI TBApiEnumAdhocValues(HTBDEVICE aDeviceHandle, ADHOC_VALUES_CALLBACK aCb, void* aContext);

 

// First, the callback routine

CstringArray ahSettings;

void _stdcall _AdhocValuesCB(void* aContext, const TCHAR* key, const TCHAR* aValue, DWORD dwValue, BOOL bIsString)

{

            CString S;

            if (bIsString)      // Was a string or dword returned??

                        S.Format("%s=%s", key, aValue);

            else

                        S.Format("%s=%ld", key, dwValue);

 

            ahSettings.Add(S);        // add to array

}

 

// Enumerate the ad hoc settings

TBApiEnumAdhocValues(m_iDeviceId, _AdhocValuesCB, NULL);

CListBox*         pLB = (CListBox*)GetDlgItem( IDC_AD_HOC_SETTINGS );

ASSERT(pLB);

 

// Display the returned values in a listbox

for (int i = 0; i < ahSettings.GetSize(); i++)

            pLB->AddString( ahSettings[i] );

 

Visual Basic Declaration/example

 

Public Declare Sub TBApiEnumAdhocValues Lib "TBapi" Alias “_DLL_TBApiEnumAdhocValues@12" (ByVal aDeviceHandle As Byte, ByVal aCB As Long, ByVal aContext As Long)