Please see my comment to the question.
See also my past answers on virtual keyboards:
How to fire a Key Press event of a Key on button click in WPF [
1],
How to fire a Key Press event of a Key on button click in WPF [
3],
Application focus getting and losing.
Don't pay attention that some answers are related to WPF (and the last one is specific to
System.Windows.Forms
, the principles are the same. The main idea is: if you need to develop system-wide virtual keyboard, you cannot rely on anything specific, such as message pumping (not used at the level of WPF controls or some other Windows software). The approach should be universal and low-level, hence
SendInput
.
—SA