I'm developing an application that converts text to keystroke (to a specific window) => in my discord for example if I want to run !press F It should press f on the specific window
however, the specific window has no Windows Message processing loop (GetMessage), it only detects raw input from a keyboard
I want to be able to reproduce it, using c# (I could run a AHK process, to fullfil this, but it's not the idea)
I try reading AutoHotKey_L code on github (keyboard_mouse.cpp specifically but could not comprehend what was going on)
Thanks a lot for any help !
This is the current code i'm using (I don't know which subprocess to send the message so I send to all of them)
Code: Select all
private static void loop_child(IntPtr current, int keycode, bool down = false, int level = 0)
{
List<IntPtr> children = GetChildWindows(current);
// This ↓ is debugging
Console.WriteLine(new string('\t', level) + current);
if (down)
PostMessage(current, WM_KEYDOWN, keycode, 0x00000001);
PostMessage(current, WM_KEYUP, keycode, 0xC0000001);
foreach (var child in children)
loop_child(child, keycode, down, level + 1);
}
All of this is on DeSmuMe Emulator