Reputation: 1483
I've seen similar functions like this in screen-recording programs for an example. You click a window of a game for example, and the program focuses on the game.
So I want to do something similar, but instead of recording the window I would like to get the Process ID/HWID/Window handle whatever from the process/program.
I hope that didn't get too messy for you guys to read...
I couldn't find anything when I was looking, but maybe it's possible somehow to see which window gets SetForeGround (obviously from when you click on it).
Anyone got any ideas?
Upvotes: 0
Views: 1422
Reputation: 48279
Start with WindowFromPoint
:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms633558%28v=vs.85%29.aspx
Then GetWindowThreadProcessId
http://msdn.microsoft.com/en-us/library/windows/desktop/ms633522%28v=vs.85%29.aspx
Lastly, GetProcessIdOfThread
http://msdn.microsoft.com/en-us/library/windows/desktop/ms683216%28v=vs.85%29.aspx
You'd have to pinvoke these, I am not sure if the .NET library has them (the first one is not in the Base class library for sure).
Upvotes: 2