[font="Arial, Helvetica, sans-serif"]Hi Devs,[/font] [font="Arial, Helvetica, sans-serif"] [/font] [font="Arial, Helvetica, sans-serif"]Im trying to turn off my XBOX 360 Controller which is connected using the wireless module from Microsoft.[/font] [font="Arial, Helvetica, sans-serif"]I can easily let it vibrate using this C# code:[/font] [font="Arial, Helvetica, sans-serif"] [/font] [font="Arial, Helvetica, sans-serif"] using SlimDX.XInput;
Controller controller = new Controller(UserIndex.One); Vibration vibration = new Vibration {LeftMotorSpeed = 0000, RightMotorSpeed = 0000}; controller.SetVibration(vibration);
[/font] [font="Arial, Helvetica, sans-serif"] [/font] [font="Arial, Helvetica, sans-serif"]But I can't find any way to turn the controller off? Is that possible with XInput at all? If not, how can it be achieved?[/font] [font="Arial, Helvetica, sans-serif"] [/font] [font="Arial, Helvetica, sans-serif"]Thanks in advance![/font] [font="Arial, Helvetica, sans-serif"] [/font] [font="Arial, Helvetica, sans-serif"]MemphiZ[/font]
You can't programmatically turn of the controller, and with wireless controllers it's actually a pain to turn off when using PC since there is no consistent UI to turn off the controller as there is on Xbox. Generally I just quickly pop the battery out and back in which will shut it down. Elegant? No, but it saves my batteries from dying.
You can't programmatically turn of the controller, and with wireless controllers it's actually a pain to turn off when using PC since there is no consistent UI to turn off the controller as there is on Xbox. Generally I just quickly pop the battery out and back in which will shut it down. Elegant? No, but it saves my batteries from dying.
Well there must be a way. Because the Author of this little Script http://djpety.nt-hosting.hu/XboxExt/ managed to do it with pure AutoIT. AutoIT is a scripting language that I know as well. The only thing I can imagine how he did it is a DLL Call/Invoke.
I was in contact with the Author of the mentioned AutoIT Script and he pointed me in the right direction. To turn off the controller you must call a hidden function in the XInput1_3.dll by its ordinal (#103) as you dont have a function name exposed.
I've written a little Utility to do that for you. The SourceCode will be available soon when my Blog relaunches (www.X-ToolZ.com). For everyone who can't wait here is the utility as a self installing/updating ClickOnce application: www.X-ToolZ.com/Downloads/X-360ControllerUtil
This C++ Code simply turns off all connected XInput devices. You can probably safely skip the XInputGetState stuff though I have not tried calling XInput1_3.dll#103 on a device that is not connected. I'm sure it will be fine.
Very possible. I would not use this in anything more than a controller manager. This is not something that any other type of application should be doing anyway.
Windows 7 ships with 4 versions of the XInput.dll though. I expect that Windows 8 will ship with the exact same XInput1_3.dll, and a new XInput1_4.dll.