TBApiSetSettingDWORD API Call

 

Description

Sets a DWORD value in the registry in the UPDD branch.

Parameters

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

Returns

0 = fail, 1 = OK.

Notes

This will set a DWORD value in the UPDD branch of the registry. Supply a valid Device handle (using TBApiGetRelativeDevice or TBApiGetNamedDevice) to set items for a specific device or pass zero to set values in the bundle branch. It is important to call TBApiApply() to commit the changes.

See also

Other registry related API calls to set and retrieve registry entries.

 

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