mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 03:07:04 +02:00
31 lines
846 B
C++
31 lines
846 B
C++
#pragma once
|
|
|
|
#include <keyboardmanager/common/InputInterface.h>
|
|
#include <keyboardmanager/common/Helpers.h>
|
|
|
|
namespace KeyboardManagerInput
|
|
{
|
|
// Class used to wrap keyboard input library methods
|
|
class Input : public InputInterface
|
|
{
|
|
public:
|
|
// Function to simulate input
|
|
UINT SendVirtualInput(UINT cInputs, LPINPUT pInputs, int cbSize)
|
|
{
|
|
return SendInput(cInputs, pInputs, cbSize);
|
|
}
|
|
|
|
// Function to get the state of a particular key
|
|
bool GetVirtualKeyState(int key)
|
|
{
|
|
return (GetAsyncKeyState(key) & 0x8000);
|
|
}
|
|
|
|
// Function to get the foreground process name
|
|
void GetForegroundProcess(_Out_ std::wstring& foregroundProcess)
|
|
{
|
|
foregroundProcess = Helpers::GetCurrentApplication(false);
|
|
}
|
|
};
|
|
}
|