PowerToys/src/modules/keyboardmanager/dll/Input.cpp
Arjun Balgovind 1533c9315f
[Keyboard Manager] Enable App-specific shortcuts in the KBM backend (#4628)
* Enable app specific shortcut remapping

* Fixed lowercase function call

* Add test file

* Moved GetForegroundProcess to II and added tests

* Fixed runtime error while testing due to heap allocation across dll boundary

* Renamed function

* Remove unused code

* Changed process checking step to include substrings

* Changed back to exact match included match without file extension
2020-07-06 16:45:53 -07:00

22 lines
575 B
C++

#include "pch.h"
#include "Input.h"
#include <keyboardmanager/common/Helpers.h>
// Function to simulate input
UINT Input::SendVirtualInput(UINT cInputs, LPINPUT pInputs, int cbSize)
{
return SendInput(cInputs, pInputs, cbSize);
}
// Function to get the state of a particular key
bool Input::GetVirtualKeyState(int key)
{
return (GetAsyncKeyState(key) & 0x8000);
}
// Function to get the foreground process name
void Input::GetForegroundProcess(_Out_ std::wstring& foregroundProcess)
{
foregroundProcess = KeyboardManagerHelper::GetCurrentApplication(false);
}