我正在尝试一些sharpDX示例,我正在尝试“未注册的类”。我从错误中看出它是一个os的东西,但我不明白为什么?我已经在sharpDX页面上安装了DX运行时,我正在使用windows7 64.虽然这是一个win32应用程序。
错误
An unhandled exception of type 'SharpDX.SharpDXException' occurred in SharpDX.dll
Additional information: HRESULT: [0x80040154], Module: [SharpDX.DirectInput], ApiCode: [DIERR_DEVICENOTREG/DeviceNotRegistered], Message: Class not registered
stack
SharpDX.dll!SharpDX.Result.CheckError() + 0x42 bytes
SharpDX.DirectInput.dll!SharpDX.DirectInput.DirectInput.CreateDevice(System.Guid arg0, out System.IntPtr arg1, SharpDX.ComObject arg2) + 0xee bytes
SharpDX.DirectInput.dll!SharpDX.DirectInput.Device.Device(SharpDX.DirectInput.DirectInput directInput, System.Guid deviceGuid) + 0x52 bytes
SharpDX.DirectInput.dll!SharpDX.DirectInput.CustomDevice<SharpDX.DirectInput.JoystickState,SharpDX.DirectInput.RawJoystickState,SharpDX.DirectInput.JoystickUpdate>.CustomDevice(SharpDX.DirectInput.DirectInput directInput, System.Guid deviceGuid) + 0x68 bytes
SharpDX.DirectInput.dll!SharpDX.DirectInput.Joystick.Joystick(SharpDX.DirectInput.DirectInput directInput, System.Guid deviceGuid) + 0x40 bytes
代码: joystickState = new JoystickState(); Guid foundDevice = new Guid(); joystick = new Joystick(directInput,foundDevice);
答案 0 :(得分:-1)
您没有正确使用API。 Guid应该与注册的DirectInput Joystick Guid相匹配。更仔细地检查与此完全相关的样本JoystickApp。