I'm having a little difficulty retrieving values from the Sensor object.... well, in some cases. It's a multithreaded app. I'm using the COM interface without ATL (or the ATL headers... by using things like TDxInput::ISensorPtr from the #import generated headers). It's based on the polling example. I call CoInitialize on all threads.
The thread I want to retrieve the sensor and keyboard values from does not have a windows message pump. Everything seems to work fine; except the values (translation and rotation angle) I get are always 0.0... but nothing fails.
When I place exactly same code in the same thread that created the window and dispatches windows messages, it all works fine... but it means a slightly less elegant design on my end.
Is this a know restriction?
I also noticed that I receive message 0xC45C when calling PeekMessage or GetMessage in the message pump (but before dispatching the message) when the 3dconnexion device is moved.
If the COM 3dconnexion code must go on the same thread as the one that created the window, can I rely on this message being sent in future driver versions? This would allow a mostly even-driven scheme without requiring ATL.
According to the windows SDK docs, this message is custom:
What system-independent method would I use to retrieve the exact ID of the message? I presume I need to know the string that RegisterWindowMessage was called with.The system returns a message identifier in the range 0xC000 through 0xFFFF when an application calls the RegisterWindowMessage function to register a message. The message identifier returned by this function is guaranteed to be unique throughout the system. Use of this function prevents conflicts that can arise if other applications use the same message identifier for different purposes.
One last comment I think I also prefer the C API (a few people have mentioned this) and I hope it continues to be supported. Although it's probably true that the COM interface is more approachable from other languages (Java, VB, etc), it's less platform-independent. With a C interface, exactly the same code could be used from MAC, Windows, Linux etc... all those HRESULTS and CoInitializes are windows specific.
If someone can let me know where do DL the old SDK, that would be appreciated.
Thanks for any help.
--tristan