Sign in to follow this  

DirectInput Error

This topic is 4594 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 been working on the input part of my game but whenever I try to call SetCooperativeLevel on the mouse it returns E_NOTIMPL. I am using DirectX 9 SDK if that has anything to do with it. Here's the relevant code:
//header
IDirectInput8 *pDI;
IDirectInputDevice8 *pDIMouse;

//source
//pDI already exists
hr = pDI->CreateDevice(GUID_SysMouse, &pDIMouse, NULL);
if (FAILED(hr)) return hr;
hr = pDIMouse->SetDataFormat(&c_dfDIMouse);
if (FAILED(hr)) return hr;
hr = pDIMouse->SetCooperativeLevel(hwnd, DISCL_FOREGROUND|DISCL_NONEXCLUSIVE);
if (FAILED(hr)) return hr; // returns E_NOTIMPL



Help Appreciated

Share this post


Link to post
Share on other sites
I think its because you are setting the mouse to non-exclusive mode. Now if I remember my DI correctly, then this means that the mouse input you receive is picked up by all applications, not just your own. So try setting it to exclusive mode. Non-exclusive mode is good when it is paired with background.

Share this post


Link to post
Share on other sites
Thanks for the advice, but when I try that the mouse disappears. This wouldn't be so bad (i can draw it) but my application is windowed and when i set the mode to exclusive no other appliation can use the mouse. I would like it so that my program recieves data when it is active, but doesn't block the mouse from leaving my window, so that other applications get use it as well. (I hope that was clear enough)

Share this post


Link to post
Share on other sites
bump

EDIT: Nevermind, I fixed it. I turned out i click emulate keyboard and mouse which disable all nonexclusive modes. Thanks for the help!

[Edited by - glat on May 14, 2005 7:33:52 PM]

Share this post


Link to post
Share on other sites

This topic is 4594 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this