I am trying to get the Spaceball 4000 to work with my application written in C++ (Visual Studio 2005). I am connecting it over a serial cable. I use Driver v2.8.2 and the 64-bit SDK 2.1.1.
My init code looks like this:
Code: Select all
...
SiOpenData open_data;
sint32_t err = SiInitialize();
if ( err != SPW_NO_ERROR )
{
VTLOG(" SiInitialize failed: %s.\n", SpwErrorString(SpwErrorVal));
SiTerminate();
return false;
}
//Win32 hwnd
WNDCLASSEX wndclass; /* our own instance of the window class */
static HINSTANCE hInst; /* handle to our instance */
memset(&wndclass,0,sizeof(wndclass));
hInst = (HINSTANCE)GetModuleHandle(NULL); /* init handle */
wndclass.cbSize = sizeof(WNDCLASSEX);
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = (WNDPROC)Device3DxImp::HandleNTEvent ;
wndclass.cbClsExtra = 8;
wndclass.cbWndExtra = 0;
wndclass.hInstance = hInst;
wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW );
wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = (LPCWSTR)"SpaceWare";
wndclass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
// Register the display windows class to be used for subsequent calls to
// CreateWindow.
if(!RegisterClassEx(&wndclass))
{
VTLOG(" Window for 3Dx device could not be registred.\n");
SiTerminate();
return false;
}
// Create a window to use for getting messages from the SpaceWare device.
HWND hwnd;
hwnd = CreateWindowEx(
0,
(LPCWSTR)"SpaceWare",
(LPCWSTR)"SpaceWareSensor",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
HWND_MESSAGE,
NULL,
hInst,
NULL);
if( hwnd == NULL )
{
VTLOG(" Window for 3Dx device could not be created.\n");
SiTerminate();
return false;
}
// init Window platform specific data for a call to SiOpen
SiOpenWinInit( &open_data, hwnd );
if ( SpwErrorVal != SPW_NO_ERROR )
{
VTLOG(" SiOpenWinInit failed: %s.\n", SpwErrorString(SpwErrorVal));
SiTerminate();
return false;
}
// open the SpaceWare device
if ((_3DxHdl = SiOpen ("GeoViz", SI_ANY_DEVICE, SI_NO_MASK, SI_EVENT, &open_data)) == SI_NO_HANDLE)
{
VTLOG(" Could not open a 3DxWare device, %s.\n", SpwErrorString(SpwErrorVal));
SiTerminate();
return false;
}
VTLOG(" 3Dx device found and initialized.\n");
...
Internal 3DxWare error
What am I doing wrong?
Does the new Driver SDK support the Spaceball 4000 serial?
Thanks for your help
Robert