0

Trying to get Joystick input with DirectX DirectInput but the program seems to hang/freeze without any errors on Manager.GetDevices().

Here is the simple code:

// C#
using Microsoft.DirectX.DirectInput;
namespace Input
{
 class Controller
 {
 static void InitJoystick()
 {
 foreach (DeviceInstance di in Manager.GetDevices( DeviceClass.GameControl, EnumDevicesFlags.AttachedOnly))
 {
 Console.WriteLine(di.InstanceGuid);
 }
 }
 static void Main(string[] args)
 {
 InitJoystick();
 }
 }
}

Does anyone know what im doing wrong?

asked May 19, 2022 at 14:07
2
  • 1
    What version of DirectX and VS are you using? Did you try running your app with admin rights? Also, check if any errors have been logged on the Event Viewer. Commented May 19, 2022 at 22:12
  • Latest DirectX Sdk (June 210) and 2022 VS. There are also no errors in the Event Viewer. I now just used SharpDX which works fine but it sucks to use a third party library. Commented May 20, 2022 at 9:00

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.