   [.net] DirectInput Problem
  I get this exceptionQuote:System.ArgumentException was unhandled  Message="Value does not fall within the expected range."  Source="Microsoft.DirectX"  StackTrace:  at Microsoft.DirectX.DirectInput.Device.Acquire()  at SoC.Core.Input.cMouse..ctor(Form window) in C:\Documents and Settings\ryan\Desktop\soc\SoC\Core\Input\cMouse.cs:line 24  at SoC.Core.cDirectX..ctor(Form window) in C:\Documents and Settings\ryan\Desktop\soc\SoC\Core\cDirectX.cs:line 27  at SoC.cKernel..ctor() in C:\Documents and Settings\ryan\Desktop\soc\SoC\cKernel.cs:line 35  at SoC.main.Main(String[] args) in C:\Documents and Settings\ryan\Desktop\soc\SoC\main.cs:line 18  at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)  at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)  at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()  at System.Threading.ThreadHelper.ThreadStart_Context(Object state)  at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)  at System.Threading.ThreadHelper.ThreadStart()With this code. I have no idea how to fix it._mouse = new Microsoft.DirectX.DirectInput.Device(SystemGuid.Keyboard);_mouse.SetCooperativeLevel(_window.Handle, CooperativeLevelFlags.Foreground | CooperativeLevelFlags.NonExclusive);_mouse.Acquire();
  Did you even read your own code? [rolleyes]_mouse = new Microsoft.DirectX.DirectInput.Device(SystemGuid.Keyboard);   ^^ mousekeyboard wtf?If you change to SystemGuid.Mouse you have a better chance of not getting an exception.   ;  My variable is named _mouse. I put the underscore to sya that its a private variable. And The SystemGuid shouldn't matter, I changed and I still get an exception.   ;  Try to call _mouse.SetDataFormat(DeviceDataFormat.Mouse);before you acquire.   ;Quote:Original post by EnselicTry to call _mouse.SetDataFormat(DeviceDataFormat.Mouse);before you acquire.Thanks!   