1

I'm looking to write a .Net Windows application that will capture how a user uses another running application.

The simplest form of this would be recording which buttons were clicked or menu items were opened. Capturing the button text or menu text would be enough.

I know this can be done by listening for events but was unsure how far this stretched. In Windows are you able to listen to another applications events or are they hidden from other applications?

If so, are there any .Net libraries I can use or open source projects to catch these events? Taking this further, turn these into generic events (im thinking lots of applications might fire events specific to them, so extracting general information is key)

If not, is the only solution to integrate my code with the application to gain access to the that applications events?

Many thanks

Elliot Williams
  • 563
  • 5
  • 11
  • I once wrote a program that recorded a log of a user's activity, i.e what window is open, what they're typing and if they click anywhere. I'm not sure if you could extend that to being able to tell what they have specifically pressed. – ediblecode Dec 30 '11 at 12:15
  • How did you get to that information? Were you only able to log which windows were open and where the mouse was? I guess those events would be on the windows level. You're right though, i think im looking for the information contained within the windows in... Windows. – Elliot Williams Dec 30 '11 at 12:23
  • I created a Windows Service that would run in the background and output to a txt file. I think `User32.dll` had the functionality to get the open window and the text within that window. – ediblecode Dec 30 '11 at 12:30
  • ah I see, sounds like the right place to begin looking. thanks. – Elliot Williams Dec 30 '11 at 12:33

2 Answers2

1

If I understand your post correctly, you need something similar to Spy++ that can hook the Windows messages and tell you when that message gets fired.

Have a look at these links:

  1. Deliver The Power Of Spy++ To Windows Forms
  2. Spying Window Messages from the Inside
  3. How can I get functionality similar to Spy++ in my C# app?
Community
  • 1
  • 1
silverspoon
  • 1,085
  • 1
  • 11
  • 22
  • amazing stuff! Those links have proved invaluable. Thanks. – Elliot Williams Jan 18 '12 at 13:58
  • In case anyone else stumbles upon this old post and is looking for the article referenced in the first link "Deliver The Power..." you will find it in the April, 2006 issue. The link above takes you to the main list, but no longer directly links to the article or issue. – Chris Jan 03 '18 at 16:05
-2
private void CaptureCameraCallback()

{

    using (CvCapture cap = CvCapture.FromCamera(CaptureDevice.Any, 1))

    {

        while (true)

        {

            Bitmap bm = BitmapConverter.ToBitmap(cap.QueryFrame());

            bm.SetResolution(pctCvWindow.Width, pctCvWindow.Height);

            pctCvWindow.Image = bm;

        }

    }

}
songyuanyao
  • 169,198
  • 16
  • 310
  • 405
Srinuvas
  • 5
  • 1