开发者

Determining the Active Window name or id

开发者 https://www.devze.com 2023-03-02 02:27 出处:网络
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开发者_StackO

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)
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号