problem with reacquiring the keyboarddevice...

Started by
11 comments, last by hajkr 22 years, 5 months ago
i have made a standard keyboard device with directx8 and it works great until another application gets the focus and i then my application gets the focus back and i want to reacquire the device when i receive the WM_ACTIVE message with m_pDevice->Acquire( ). But when the app gets the focus back it return an device-error. Does anybody have an solution ?
Advertisement
Have you tried different cooperative levels for your keyboard? You might want to try setting it to non exclusive and in the background.





------------------------------
"I''m a decorated astronaut, I don''t make those kind of mistakes."
"Oh now wait a minute. Look I''ll show ya. I''ll enter the same calculations using what we like to call ''The Right Way''."

-Rem
Zirem Software
------------------------------"I'm a decorated astronaut, I don't make those kind of mistakes.""Oh now wait a minute. Look I'll show ya. I'll enter the same calculations using what we like to call 'The Right Way'."-RemZirem Software
Yes i already have tried all possible combinations of cooperative flags. I think thats not the problem.
I think your problem is that your aquiring the keyboard when your app loses focus and regains focus.

Try acquring the keyboard when you receive focus, and release it when you lose focus.

Personally, my DirectX lib doesn''t have this problem



------------------------------
"I''m a decorated astronaut, I don''t make those kind of mistakes."
"Oh now wait a minute. Look I''ll show ya. I''ll enter the same calculations using what we like to call ''The Right Way''."

-Rem
Zirem Software
------------------------------"I'm a decorated astronaut, I don't make those kind of mistakes.""Oh now wait a minute. Look I'll show ya. I'll enter the same calculations using what we like to call 'The Right Way'."-RemZirem Software
i acpuire the device when i get the focus.
But do i really need to unacquire it when i loose the focus?
Doesn''t it unacquire by itself or by windows?
As far as I know, it doesn''t.



------------------------------
"I''m a decorated astronaut, I don''t make those kind of mistakes."
"Oh now wait a minute. Look I''ll show ya. I''ll enter the same calculations using what we like to call ''The Right Way''."

-Rem
Zirem Software
------------------------------"I'm a decorated astronaut, I don't make those kind of mistakes.""Oh now wait a minute. Look I'll show ya. I'll enter the same calculations using what we like to call 'The Right Way'."-RemZirem Software
Hey What kind of error is Acquire returning?

It returns DIERR_NOTACQUIRED, when i call "GetDeviceState()"
But i''m acquierung it when the WM_ACTIVE-Message arives and there it returns no error.
So I don''t understand why it can not be acquired.
...and if i try to acquire it every frame before i use "GetDiveState()" it returns DIERR_OTHERAPPHASPRIO.
I can''t understand that.
This is unlikely, but it could just be your development machine. Hit Ctrl-Alt-Del to get the task list and close all unrelated processes. There might be something running there that has taken control of the keyboard.

Superpig
- saving pigs from untimely fates

Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse

This topic is closed to new replies.

Advertisement