Jump to content
  • Advertisement


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


DirectInput SetProperty()

This topic is 5507 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 have a problem with IDirectInputDevice8::SetProperty. It just fails everytime. Here´s the code:
prop.diph.dwSize = sizeof(DIPROPDWORD);
prop.diph.dwHeaderSize = sizeof(DIPROPHEADER);
prop.diph.dwObj = 0;
prop.diph.dwHow = DIPH_DEVICE;
prop.dwData = INPUTBUFFERSIZE;   
HRESULT error = lpKeyboard->SetProperty(DIPROP_BUFFERSIZE, &prop.diph);
if ((error != DI_OK) || (error != DI_PROPNOEFFECT))
  //error code here

In the DirectX documentation it says error can be one of the following if the function fails: DIERR_INVALIDPARAM, DIERR_NOTINITIALIZED, DIERR_OBJECTNOTFOUND, DIERR_UNSUPPORTED. I´ve checked this to but that´s not the case. It´s not DI_OK and it´s not one of the others. It just plain fails for some reason. And if I let the program run, it crashes when it reaches the call to IDirectInputDevice8::GetDeviceData. Probably because SetProperty failed earlier. Anyone know what could be wrong?

Share this post

Link to post
Share on other sites
Your error checking has gone pear-shaped. You used OR when you meant AND. So, if you get DI_OK, then it won''t equal DI_PROPNOEFFECT, and it will go into your error code.

If you checked the error code and it wasn''t one of the "official" codes, then what was it?

Share this post

Link to post
Share on other sites
Thanks for the reply. I edited the code slightly when I posted it to make it easier to read and overlooked that ||. The actual error code looks like:

if (error != DI_OK)
// error handling

Anyway, it´s still failing but it´s not one of the DIERR_ codes that´s in the DX documentation. I saw now you can set the bufferpropertys with SetActionMap too, I´ll try that instead later.

Share this post

Link to post
Share on other sites
I think I found it now! I noticed I did the SetProperty() after the lpKeyboard->Acquire(). So I changed that and now SetProperty seem to succeed. It´s always something simple! But GetDeviceData still fails. Well, that´s one problem out of the way.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!