Embarcadero RAD Studio and Windows SDK

Post questions, comments and feedback to our 3Dconnexion Windows Development Team.

Moderator: Moderators

Embarcadero RAD Studio and Windows SDK

Postby spietari » Fri Jun 15, 2012 9:57 am

Hi,

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
      return false;
   }
   else
   {
      return false;
   }
spietari
 
Posts: 3
Joined: Fri Jun 15, 2012 9:47 am

Re: Embarcadero RAD Studio and Windows SDK

Postby jwick » Fri Jun 15, 2012 11:22 am

Can you install 3DxWare 10 beta 12? It has better error messages in the log file.

Don't call SiSetUiMode.
jwick
Moderator
Moderator
 
Posts: 1756
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA

Re: Embarcadero RAD Studio and Windows SDK

Postby spietari » Fri Jun 15, 2012 2:12 pm

Thanks. I upgraded the software and removed the call you mentioned. The results are still the same and the log file gives now:

00000001 0:10:5.169: UdCtlOpen: UdCtl: Open request denied due to bad parameters.
(IsWindow(0x1) == FALSE)
ffffffff 0:10:5.170: Driver Si: Attempt to call UdCtlOpen failed

Seppo
spietari
 
Posts: 3
Joined: Fri Jun 15, 2012 9:47 am

Re: Embarcadero RAD Studio and Windows SDK

Postby jwick » Wed Jun 20, 2012 9:57 am

Something is happening to your HWND on the way to that code. If you have a small sample that demonstrates it, I can trace your structure from the point we receive it. I'd suspect some sort of alignment/size/copy/constructor issue. Clearly 1 is not a valid HWND.
jwick
Moderator
Moderator
 
Posts: 1756
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA

Re: Embarcadero RAD Studio and Windows SDK

Postby alessandromota » Wed Aug 08, 2012 10:43 am

Dear all,
Please, what have I to do for the Space Navigator to work in C++ Builder? My first try was use 3DxInput.dll but I was not succeed.
alessandromota
 
Posts: 1
Joined: Fri Jun 22, 2012 5:51 am


Return to Developer's Forum for Windows

Who is online

Users browsing this forum: Exabot [Bot] and 1 guest