Archived

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

Yair Konfino

DirectInput Example

Recommended Posts

Setting a direct input device (mouse, keyboard, etc) to exclusive mode means that you will only be using 1 device.

Is this really what you want? to use JUST the mouse OR the keyboard in your program?

Share this post


Link to post
Share on other sites
quote:
Original post by RhoneRanger
Setting a direct input device (mouse, keyboard, etc) to exclusive mode means that you will only be using 1 device.

Is this really what you want? to use JUST the mouse OR the keyboard in your program?


correction: It means one device of the same type (Keyboard for instance) not: keyboard OR mouse etc..

From the docs:
DISCL_EXCLUSIVE
The application requires exclusive access. If exclusive access is granted, no other instance of the device can obtain exclusive access to the device while it is acquired. However, nonexclusive access to the device is always permitted, even if another application has obtained exclusive access.


____________________________________________________________
Try RealityRift at www.planetrift.com

Share this post


Link to post
Share on other sites
quote:
Original post by RhoneRanger
Setting a direct input device (mouse, keyboard, etc) to exclusive mode means that you will only be using 1 device.

Is this really what you want? to use JUST the mouse OR the keyboard in your program?


thanks a lot for the info !

the problem is :
i play UnrealTournament a lot. so i decided to write a simple
keyboard hook program that will generate a sequence of keystrokes
on every specific stroke i want ( using SendInput ).
this program works well for MS Word , notepad and wordpad.
which means that when i hit my key i get a sequence of other keys. from some reason this fails when UT is running.
so i guess ut is using Exclusive mode on the keyboard.
this is why i need to check with a program that uses
exclusive mode.
any ideas are appreciated.

Share this post


Link to post
Share on other sites
I would assume (not sure though) that they set this parameter in the setup
if(FAILED(Keyboard->SetCooperativeLevel(hWnd,
DISCL_FOREGROUND | DISCL_EXCLUSIVE)))
return E_FAIL;

This means that DirectX has TOTAL control over the keyboard (DISCL_FOREGROUND);

Share this post


Link to post
Share on other sites
quote:
Original post by RhoneRanger
Exactly!




No, not exactly. You can acquire both the keyboard and mouse (and whatever other devices you want) in exclusive mode from your application.

Share this post


Link to post
Share on other sites