I made a version with DirectInput that is buffered and it works almost fine. One problem I found is when using the exclusive mode the cursor is lost, and other is the movement values of the mouse are not the same as the desktop mouse, making my cursor to delay it's position. Anyway, even solving this problem I'm limiting the coordinates of the mouse inside the window frame, causing the app and desktop pointer to have different positions. And, even with the desktop cursor hidden, I can see it interacting with background windows, not clicking but rolling over :? And it's supposed to be foreground and exclusive, no idea why it makes that! :x
So, I don't want to fight nature anymore, and instead I want to allow and show the desktop cursor always, and I want to follow it while it crosses the window. But I have followed tutorials, I have followed the sample in DX9 SDK (the code for inmediate mode is so simple compared to buffered), but I just can't make it work!! :x When I call GetDeviceState, it returns errors. I Adquire the device in a loop, and it returns 1, but when calling GetDeviceState it keeps returning some error code. It's hard to debug which error it is, but after crawling in the code I found it sends: DIERR_INVALIDPARAM... According to SDK:
"An invalid parameter was passed to the returning function, or the object was not in a state that permitted the function to be called. This value is equal to the E_INVALIDARG standard COM return value."
Not very informative. What can I do? I'm starting to hate DirectInput, it offers full control of the device, but that's not true... maybe I should read the mouse coordinates with WinAPI. Just in case, I'm using a formless application. Any suggestion?? Thanks in advance for any help.
Bookmarks