[Mono-dev] AppActivate and System.Windows.Forms.SendKeys on Ubuntu 10.10

Quandary quandary82 at hailmail.net
Wed Mar 16 16:07:06 EDT 2011

What, only SendKeys to WinForms, are you serious ?
That doesn't make much sense.

The SendKeys function is just a static method that resides in
and has nothing to do with WinForms otherwise.

It sends KeyEvents to the Windowing system, which happens to be the
WinAPI on Windows, or X11 on Linux for all intents and purposes.
GTK has nothing to do with it.

You send the keyboard keys as simulated input to X11, and before that,
you set the focus window.
X11 processes it, and forwards the input to the respective application's
Using it works with everything, GTK+/WinForms/QT/wxWidgets/Java etc.,
since it's just the same as if you press a keyboard key.

At least on Windows.
And if mono doesn't, that's a bug and needs to be fixed.

SendKeys is the only way to steer a 3rd party applications if every
other method fails or isn't implemented applicationwise.

If it was a WinForms application, it would mean it's written in C#,
which would mean I could just automagically reverse engineer it and
recreate a console application instead of resorting to sendkeys.

On 03/16/2011 08:07 PM, Bojan Rajkovic wrote:
> Erm, I don't think SendKeys for WinForms is going to work against !WinForms apps on Linux. gEdit is GTK+, so the mainloops don't match at all, and gEdit likely isn't expecting any keys from Mono.
> —Bojan

More information about the Mono-devel-list mailing list