tags:

views:

51

answers:

1

Hi, can someone give me a clue as to how to accomplish the following:

By clicking on an application's window, I'd like to determine the process id of executable concerned.

+1  A: 

There is a fair amount of Win32 API calls required to get this to work in .NET. I would suggest you look at the .NET open source project Process Hacker as it does what you want already.

It is LGPL licensed and provides libraries to include in your project to get it's functionality. From the FAQ

I'm a developer. Can I use the various functions provided by Process Hacker in my own program?
If you're using a .NET-based language (C#, VB.NET), absolutely! Simply download the source code (or checkout the latest SVN revision), build the solution, and reference ProcessHacker.Common and ProcessHacker.Native in your project.

ParmesanCodice