ExKode Forum

Dxtory => Help & Support => Topic started by: niv on March 05, 2016, 12:27:18 AM

Title: C++: dxtory key hooks not reacting to SendInput
Post by: niv on March 05, 2016, 12:27:18 AM
Hey,

I'm trying to get dxtory to react to keys emitted via SendInput(). (Background: mapping the xbox guide button to screenshot).

Relevant code snippet:


INPUT inp;
inp.type = INPUT_KEYBOARD;
inp.ki.wScan = MapVirtualKey(44 /*PRINTSCR*/, MAPVK_VK_TO_VSC);
inp.ki.wVk = 0;
inp.ki.time = 0;
inp.ki.dwExtraInfo = 0;
inp.ki.dwFlags = KEYEVENTF_SCANCODE;

SendInput(1, &inp, sizeof(inp));

std::this_thread::sleep_for(std::chrono::milliseconds(50));

inp.ki.dwFlags = KEYEVENTF_KEYUP | KEYEVENTF_SCANCODE;
SendInput(1, &inp, sizeof(inp));


Other, regular keys are sent just fine to apps like notepad; however any DirectInput as well as dxtory seems to not see those events.

Any idea what's wrong?
Title: Re: C++: dxtory key hooks not reacting to SendInput
Post by: Takedown on March 05, 2016, 01:27:43 PM
If you just want the functionality , why not just use a joy to key mapping program ?
https://www.reddit.com/r/pcgaming/comments/3lpayi/programs_to_map_360one_controller_guide_button_to/ (https://www.reddit.com/r/pcgaming/comments/3lpayi/programs_to_map_360one_controller_guide_button_to/)