Archived

This topic is now archived and is closed to further replies.

Mouse Acquire Error

This topic is 5982 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am using C++ Builder 5 and I´ve been successfull creating a device for the keyboard and joysticks but this one is not working... Can anyone see any error in this short idiot code:

HRESULT hr;

hr = DInput->CreateDevice(GUID_SysMouse, &didMouse, NULL);

hr = didMouse->SetDataFormat( &c_dfDIMouse );

hr = didMouse->SetCooperativeLevel( FormHandle, DISCL_FOREGROUND | DISCL_EXCLUSIVE );

hr = didMouse->Acquire();

 
DInput is a valid pointer to a DirectInput8 interface... didMouse is a pointer to a DIRECTINPUTDEVICE8 FormHandle is the handle of the main form of my application... I am getting a DIERR_OTHERAPPHASPRIO when trying to acquire the mouse... "- To begin with, said the Cat, a dog''s not mad. You grant that? - I suppose so, said Alice. - Well, then, - the Cat went on - you see, a dog growls when it''s angry, and wags its tail when it''s pleased. Now I growl when I''m pleased, and wag my tail when I''m angry. Therefore I''m mad."

Share this post


Link to post
Share on other sites
quote:
Original post by Funkymunky
This error can be returned when an application has only foreground access to a device but is attempting to acquire the device while in the background. Is your window created yet?


Yes, the window is already created. I am writing an engine and the keyboard and joystick code are both working fine. Now I´ve decided to write code for the mouse and it is not working...

Also, I am using DirectX 8.0. Should I download the 8.0a version?

André

"- To begin with, said the Cat, a dog''s not mad. You grant that?
- I suppose so, said Alice.
- Well, then, - the Cat went on - you see, a dog growls when it''s angry, and wags its tail when it''s pleased. Now I growl when I''m pleased, and wag my tail when I''m angry. Therefore I''m mad."

Share this post


Link to post
Share on other sites
I´ve discovered that my dinput code was correct, but there was an error at the DirectDraw creation part...


Thank you very much for replaying Funkymunky


André

"- To begin with, said the Cat, a dog''s not mad. You grant that?
- I suppose so, said Alice.
- Well, then, - the Cat went on - you see, a dog growls when it''s angry, and wags its tail when it''s pleased. Now I growl when I''m pleased, and wag my tail when I''m angry. Therefore I''m mad."

Share this post


Link to post
Share on other sites