bbTablet Fix

January 01, 2014 - Admin Tags: ,

bbtablet, developed by William Baxter, is a bare-bones WinTab wrapper C++ API for making the lives of Win32 programmers who wish to have Wacom tablet support in their apps a lot easier. Long story short, Curver, an application I'm working on, uses it, and it suddenly broke. I toyed around with it and I think I fixed the problem. I could be wrong here, as I haven't delved too deep into the WinTAB API.

Here is the accompanying ReadMe file.

This is bbtablet with the modifications I made (mainly in bbtabwin.cpp) to make it run again. For some reason, after porting my project (which uses bbtablet of course) from VS2005 to vs2008 it stopped working and started crashing with a stack corruption error. Debugging revealed the call to bbTabletDevice::getInstance().initSystems() to be the culprit. Long story short, the cause was apparently that the author used code like this:

int tabnum=0;
while (0 != (ret = pfWTInfo(WTI_DEVICES+tabnum, DVC_HARDWARE, &hwFlags)))

to determine the number of devices. The code which works without problems is:

UINT nDevices = 0;


This leads me to believe that the actual reason behind it not working anymore is not the switch from vs2005 to vs2008 but probably a coincidental tablet driver upgrade! The behavior of WTInfo() seems to have changed in a way that breaks the original code. That's why verbose debugging was reporting some 500 tablets and 400 cursors... etc (or whatever the numbers were).

Also, the code now uses the TCHAR type, and debug messages are now sent to OutputDebugString() instead of stderr.

If this works for you, or if you have any feedback, leave a comment.