Simulate mouse clicks and key strokes

I was wondering if there was a functionality under OF to send these events to the window management framework. I’m working under Windows.


It’s not included in OF but there is a fairly easy way to do it: you want SendInput

Thanks a lot. Apparently I need to define _WIN32_WINNT to 0x500 or higher. In case someone needs to use this, this is set in ofConstants.

SendInput works great for keystrokes, for mouse control on Windows you can use the following header file:

Based on this SO answer.

Note: I’m using Visual Studio, if not you should link to the User32.lib library. (User32.dll).