TBApiSetSettingDWORD API Call

 

Description

Sets a DWORD in the general and device sections of the settings file.

Parameters

Device handle (see notes), settings key name and value.

Returns

0 = fail, 1 = OK.

Notes

This will set a DWORD value in the settings file. Supply a valid Device handle to set items for a specific device in the device section or pass zero to set values in the general driver section. It is important to call TBApiApply() to commit the changes.

See also

Other settings related API calls to set and retrieve updd setting.

 

Visual C++ Declaration/example

 

BOOL TBAPI TBApiSetSettingDWORD(HTBDEVICE aHandle,const TCHAR* aName, unsigned long val);

 

//

// Flip the 'enabled' state of the driver

//

int dev = TBApiGetRelativeDevice(0);
DWORD bEnabled;

 

TBApiGetSettingDWORD(dev,_T("Enabled"),&bEnabled); 
TBApiSetSettingDWORD(dev,_T("Enabled"),bEnabled ^ 1); 
TBApiApply();   // apply the change

 

 

Visual Basic Declaration/example

 

Public Declare Function TBApiSetSettingDWORD Lib "TBapi" Alias "_DLL_TBApiSetSettingDWORD@12" (ByVal aDevice As Byte, ByVal aName As String, ByVal val As Long) As Long

 

‘ Flip the ‘enabled’ state of the driver

Dim DeviceId As Byte

Dim result As Long

Dim addrl As Long

addrl = VarPtr(l)

 

DeviceId = TBApiGetRelativeDevice(0)

result = TBApiGetSettingDWORD(DeviceId, "Enabled", addrl)

result = TBApiSetSettingDWORD(DeviceId, "Enabled", 1 - l)

TBApiApply