Sign in to follow this  
Tiberius

Managed DirectX Question

Recommended Posts

I recently decided to try and learn a bit about managed DirectX and ran into a problem I can't seem to solve. When I try to set the cooperative level for a keyboard device I always get an InputException. As far as I can tell, I am following Tom Miller's code example exactly. Any ideas? Thanks all.
try
{
        device = new Device(SystemGuid.Keyboard);
	device.SetCooperativeLevel(this,CooperativeLevelFlags.Background | CooperativeLevelFlags.NonExclusive);
	device.Acquire();
}
catch (InputException e)
{
				
	MessageBox.Show(e.Message, "error");
		
}


Share this post


Link to post
Share on other sites
Hi all,

Unfortunately, InputException is the exact error. I am not getting one of the derived errors that inherits from InputException. I have placed catch blocks for all of the possible InputException types (and taken out the generic InputException) and I just get an "Exception not handled" error, so I have been unable to pin down exactly what it is complaining about.

The e.message message is simply "Error in application". I have even gone into the debugger and looked at every single field of e (boy there are a lot) and there is absolutly no message that is more specific as to what is wrong. They all just have this generic InputException.

"this" refers to the form. I have tried replacing it with the actual name of the form, but got the same results.

thanks again

Share this post


Link to post
Share on other sites

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