0

The code below is using SlimDx.dll for initializing Direct input libraries. I can only use it ONE TIME is each run, For example there is a button which use this code, I want to initializing direct input as many times as I click on this button but it is not happening and only ONE TIME with the first click.

DirectInput directInput = new DirectInput();

How to fix this problem?

Inside Man
  • 4,194
  • 12
  • 59
  • 119
  • 1
    Only initialize DirectInput once? Why do you want to do it over and over? Because you can't separate the button's action from initialization of DX? There's another problem here that we can't solve with the provided info. – spender Jun 01 '14 at 14:58
  • in windows registry there is a key which store connected joysticks' information. If you initialize direct input this key will update and add keys for new connected joysticks, now I want to connect another joystick and call direct input to create its key in registry, I must close application and run it again to do it, but If I can do it by a button it is more easy. – Inside Man Jun 01 '14 at 15:02
  • How do you know that it's initialized only once? Have you tried disposing of the old DI before creating a new one? – Nico Schertler Jun 01 '14 at 15:12
  • How to know? simple, I you connect a new joystick and click on the target button, it should create its keys in registry by calling DI, but you can call DI only one time per each run, so you should close and run the app again. And Yes I tried Disposing it. – Inside Man Jun 01 '14 at 15:22
  • I find it a bit strange that a system registry key is created when you initialize DI. Are you sure about this? Have you any reference that supports this statement? In the end, you witness that the key is not created and infer that DI is not initialized a second time? – Nico Schertler Jun 01 '14 at 20:15
  • for first part, yes I'm sure, here it is: HKEY_CURRENT_USER\System\CurrentControlSet\Control\MediaProperties\PrivateProperties\Joystick ,,,for the end, YES exactly. – Inside Man Jun 01 '14 at 20:20

0 Answers0