Just gonna bump this 'cos I found out and people might be interested.
Use LoadLibrary to load xinput1_3.dll from the system directory and use GetProcAddress on the resultant handle to load a function from ordinal 100 matching this signature:
__stdcall int secret_get_gamepad (int, XINPUT_GAMEPAD_SECRET*);
function pointer syntax:
int(__stdcall *secret_get_gamepad) (int, XINPUT_GAMEPAD_SECRET*);
The int is the controller index.
The struct it outputs to (I called it XINPUT_GAMEPAD_SECRET) is very similar to but different from XINPUT_GAMEPAD and looks like this:
typedef struct
{
unsigned long eventCount;
WORD wButtons;
BYTE bLeftTrigger;
BYTE bRightTrigger;
SHORT sThumbLX;
SHORT sThumbLY;
SHORT sThumbRX;
SHORT sThumbRY;
} XINPUT_GAMEPAD_SECRET;
Create such a struct and pass its address to secret_get_gamepad. It returns 0 on success or 1167 on failure.
Then bitiwse AND wButtons against 0x00400 to see if the guide button is down.
With thanks to this code on some guy's github:
https://github.com/DieKatzchen/GuideButtonPoller/blob/master/GuideButtonPoller.cppNo clue how he figured it out.
I made a Game Maker DLL to do this:
http://gmc.yoyogames.com/index.php?showtopic=570472&st=0&p=4210058&#entry4210058 (source also available).