Determining the Active Window name or id
hello im using VB 2008
is it possible to get active window name or id?
for example i have active notepad window, now how i can get it's process name or process ?id(better is process id开发者_StackOverflow社区)
You need to use Pinvoke to execute some Win32 API to get all this info. Below is the sequence of Pinvoke that you need to use.
- GetForegroundWindow (to get current active window handle - hwnd)
- GetWindowThreadProcessId (to get the process ID and thread ID for the hwnd that you got in the above API call)
精彩评论