If you have a windows application, from another program you can send
messages to your application by using win32 functions. see msdn.
I don't know if this helps but here it is a link:
http://www.codeproject.com/cpp/sendkeys_cpp_Article.asp
I think there must be something for linux too. I used a while ago a
wrapper library for perl and it worked with linux and windows. It is
called guitest or something like that, and for linux: X11 Guitest I
think.
Let me know if you find a better solution.