Send key strokes to another application C#

前端 未结 6 790
生来不讨喜
生来不讨喜 2021-01-16 00:15

I need to automate FileMon.exe to startup with filters, save out the log it generates, and then exit.

My solution has been to write an assist application that will d

相关标签:
6条回答
  • 2021-01-16 00:18

    Use something like AHK (Auto HotKey) it is a simple language that can be compiled to an EXE and is designed for automating the keyboard and mouse.

    Also the IRC Channel and Forums always have people willing to help if need be.

    0 讨论(0)
  • 2021-01-16 00:32

    You could use powershell and the windows automation cmdlets up on www.codeplex.com/wasp to do this.

    -Oisin

    0 讨论(0)
  • 2021-01-16 00:35

    You can use Windows.Forms.SendKeys to send keystrokes to the active application.

    0 讨论(0)
  • 2021-01-16 00:39

    As I know, you have to invoke some of native APIs:

    -FindWindow to find parent windows you want to work with

    -FindWindowEx to find true windows you'll send message to

    -SendMessage to send key strokes to those windows

    Details of these APIs, refer at MSDN :)

    0 讨论(0)
  • 2021-01-16 00:39

    Thanks for all the answers and help guys... I'm actually going to write and invoke a perl script using Win32::GuiTest.

    0 讨论(0)
  • 2021-01-16 00:43

    That's probably a deaad end. You should look and see if the application (or one of its dependent DLLs) exposes the proper API calls to do what you are trying to do. If you had to do it by keystrokes, you could look into some kind of macro program like MacorMaker.

    0 讨论(0)
提交回复
热议问题