I've just recently got the SDK and I got to a point where I'm calling SiOpen. I'm using Embarcadero (Borland) C++Builder for development.
I can't use the DLL directly from a VCL/FireMonkey Form because of the underscore issue with VisualC DLLs within the Borland Compiler. So I created a DLL that simply calls the routines from the siappdll.dll.
Of course I don't have a window handle inside the DLL but Borland offers me a AllocateHWnd funtion that can be used to create one. Now it seems that SiOpen doesn't like this handle as it's always giving error 4, bad parameter. Log file says:
19:45:51.070: UdCtl: Protocol 30 request to open connection for hwnd 0xffffffff.
19:45:51.070: UdCtl: Open request denied due to bad parameters.
19:45:51.070: Driver Si: Attempt to call UdCtlOpen failed
My hwnd seems to be ok, it's not the alleged 0xffffffff.
I've also tried to pass the FireMonkey window handle to SiOpen using FmxHandleToHWND but it gives the same result.
Any ideas how to make this work under the Delphi/C++Builder environment?
I'll post the relevant code here just in case:
- Code: Select all
SiOpenData oData; //OS Independent data to open ball
if (SiInitialize() == SPW_DLL_LOAD_ERROR) //init the SpaceWare input library
// ShowMessage(L"Error: Could not load SiAppDll dll files");
int n = SiGetNumDevices(); // Gives nicely 1
SiOpenWinInit(&oData, m_hWnd); //init Win. platform specific data
SiSetUiMode(&m_DevHdl, SI_UI_ALL_CONTROLS); //Config SoftButton Win Display
//open data, which will check for device type and return the device handle
// to be used by this function
if ((m_DevHdl = SiOpen("app name", SI_ANY_DEVICE, SI_NO_MASK, SI_EVENT, &oData)) == NULL)
extern enum SpwRetVal SpwErrorVal;
// Gets here with error code 4
SiTerminate(); //called to shut down the SpaceWare input library