Can ARDUINO MICRO be used to SIMULATE physical key press at kernel level

Hi, I am brand new to Arduino,

TL;DR:
I was wondering whether it is possible to call some of the Keyboard.xxx functions by events generated at the WinAPI level to generate a physical key press. For those of you who are wondering, this is not for creating game bots or spammers :wink: I need to interface with an assistive technology software for using an alternate access method.

Long story:
I have a software that takes the events of “F12” keystroke as an activation switch. I’ve tried using most common “sendKey/ scancode” functions in python, C++, C#, and also AutoIT, AutoHotKey to achieve this - none of them has worked.

This is because, this specific software filters out simulated keypresses by the common method of listening to the LLKBHF_INJECTED flag (LowLevelKeyBoardHookFlag_INJECTED; 0x10).

Unfortunately, from what I read, Windows generates the flag above for all simulated keystrokes generated at the WinAPI level. I would write my own keyboard driver, except that I have no idea how to.

So, I was wondering whether I can trigger some of the Arduino functions (with Arduino Micro attached to the computer) by calling it from Python, C++, C# etc…

Thank you in advance!

Peter

Yes it’s possible to implement on arduino USB HID device. But I believe that i’s simpler if you just implement a dummy windows keyboard driver.

thank you for your reply Alesam. Do you have any links you could point me towards please? am shooting in the blind here.

Apart from emulating an USB keyboard, even the smallest Arduino can emulate a PS/2 keyboard. A forum search should reveal a number of hints.

So, I was wondering whether I can trigger some of the Arduino functions (with Arduino Micro attached to the computer) by calling it from Python, C++, C# etc...

An Arduino Micro, Leonardo, Pro Micro can emulate a USB keyboard. The MKR and Zero boards can also do the same.

All of the boards appears as both USB keyboard and USB serial so it is possible for a program running on the computer to send a trigger character or string to the Arduino board which causes it to send back one or more USB keystrokes. Windows does not know the Arduino is not a real keyboard.

https://www.arduino.cc/reference/en/language/functions/usb/keyboard/

PeterYoo: thank you for your reply Alesam. Do you have any links you could point me towards please? am shooting in the blind here.

https://docs.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk