Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 20 Nov 2011
Offline Last Active Aug 25 2015 01:48 PM

Posts I've Made

In Topic: Turn off XBOX 360 Controller

20 November 2011 - 06:04 PM

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.

In Topic: Turn off XBOX 360 Controller

20 November 2011 - 07:15 AM

Glad that you got it working MemphiZ, this is basically the only thread that I could find that was discussing this issue.

Here is some sample code on how to do this.

$nController = 1
$XInputDLL = DllOpen("xinput1_3.dll")
DllCall($XInputDLL, "long", 103, "int", $nController)

#include <windows.h>
#include <iostream>
#include "C:/Program Files (x86)\\Microsoft DirectX SDK (June 2010)\\Include\\XInput.h"

#pragma comment(lib, "C:\\Program Files (x86)\\Microsoft DirectX SDK (June 2010)\\Lib\\x64\\XInput.lib")

using namespace std;

typedef int (*FnOff)(int);

int wmain() {
	HINSTANCE hXInputDLL = LoadLibraryA("XInput1_3.dll");
	if (hXInputDLL == NULL) {
		cout << "ERROR: Unable to load XInput1_3.dll!" << endl;
		return 1;

	unsigned result;
	for (short i = 0; i < XUSER_MAX_COUNT; ++i) {
		memset(&state, 0, sizeof(XINPUT_STATE));

		result = XInputGetState(i, &state);

		if(result == ERROR_SUCCESS) {
			FnOff pOff;
			pOff = FnOff(GetProcAddress(hXInputDLL, reinterpret_cast<char*>(103)));
	return 0;

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.