In WinUI3 desktop application: PostMessage of WM_KEYDOWN/WM_CHAR doesn't produce typed characters (VK_TAB works)
Hi,
I'm working on WinUI3 desktop application in CPP. I want to simulate the Key Press behaviour in my application, but I don't want to injects input at the OS level, so whatever application has focus will see it exactly as if the user typed it. I want to inject the keypress only to my application. So I extracted the HWND from WinUI3 window and used PostMessage API to simulate the Key Press event. But I’m struggling with PostMessage when trying to simulate keystrokes. I can make VK_TAB work (it moves focus), but character keys like T, A, etc. are ignored by the target window. I tried multiple variants (WM_KEYDOWN with VK codes, WM_CHAR, VkKeyScan, WM_KEYUP) but the target app still does not receive/act on the character input. I’d like to understand why PostMessage fails for characters and what the recommended.
Windows development | Windows App SDK
1 answer
Sort by: Newest
-
Deleted
This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.
7 deleted comments
Comments have been turned off. Learn more