can someone give me a clue a开发者_高级运维s to how to accomplish the following:
By clicking on an application's window, I'd like to determine the process id of executable concerned.
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.
精彩评论