//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
DirectInput Error
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:
Help Appreciated
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.
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)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement