Managed DirectX Question

Started by
3 comments, last by Tiberius 19 years, 7 months ago
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");
		
}


Advertisement
Can you post the actual Error message.
Mykre - BlogVirtual Realm :- XNA News and Resources from Down Under** For those Interested in an Australian XNA User Group Contact me though my site.
What is the 'this' context you are working with; a form or a picturebox?
________________________________________________Chris McGuirkLead Programmer - Axiom 3D EngineC# gaming, the way of the future!http://www.axiom3d.org
What is the exact debug output that you are getting? An InputException could be any number of things, so try to be more specific. Thanks.
Sean Henley [C++ Tutor]Rensselaer Polytechnic Institute
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

This topic is closed to new replies.

Advertisement