0

I would like to monitor button clicks in an external Windows Forms application from my own application.

I have found examples that allow me to 'click' buttons in an external application (using Windows API), but this is not what I want to do.

The reason for this is that I would like to do some logging on an external application that a company made for us. They are willing to program the logging into that application, but it is overly expensive.

Can anyone help me with this?

Regards, Reinier

  • @Reinier: Take a look: http://stackoverflow.com/questions/8679307/capturing-user-events-button-clicks-etc-from-another-windows-application?rq=1 – Leo Chapiro Aug 06 '14 at 10:38
  • You might want to look into [UI Automation](http://msdn.microsoft.com/en-us/library/ms748252(v=vs.110).aspx). It's not a small topic though. – Damien_The_Unbeliever Aug 06 '14 at 10:38
  • You can use windows message hooks, but it's very tricky in C#. See this question, for example: http://stackoverflow.com/questions/9665579/setting-up-hook-on-windows-messages In your case, you would want to hook on `WM_CLICK`, probably. – Luaan Aug 06 '14 at 10:38

1 Answers1

2

Usually this is done by installing a Windows hook. The API is SetWindowsHookEx (see http://msdn.microsoft.com/en-us/library/windows/desktop/ms644990(v=vs.85).aspx). It's a really advanced task. The monitoring code can be implemented using .NET Framework and C# or VB.NET, but it would be better to use C or C++ for this.

Dan
  • 1,927
  • 2
  • 24
  • 35