获取所有窗口句柄的过程句柄、窗口、过程

2023-09-03 03:56:18 作者:人帅极薄累。

使用微软间谍++,我可以看到,属于一个进程如下窗口:

工艺XYZ窗口句柄,在树的形式,就像间谍++显示给我:

  A
  乙
  C
     ð
Ë
F
  G
  H
  一世
  Ĵ
     ķ
 

我能得到这个过程中,和MainWindowHandle属性指向句柄窗口F.如果使用的是我能得到窗口的列表句柄至K G I枚举子窗口,但我无法弄清楚如何找到窗口句柄A至D。我怎么能枚举窗口不由MainWindowHandle指定的进程对象的句柄的孩子?

要列举我使用的是Win32调用:

  [System.Runtime.InteropServices.DllImport(strUSER32DLL)
            公共静态外部INT EnumChildWindows(IntPtr的的HWND,WindowCallBack pEnumWindowCallback,INT iLParam);
 
谁能这一个易语言 取指定进程窗口句柄,然后取窗口句柄下按钮的句柄 按钮名称已知 最后发送 按下

解决方案

IntPtr.Zero 的hWnd 来让每根窗口句柄在系统中。

您可以再通过调用GetWindowThreadProcessId.

Using Microsoft Spy++, I can see that the following windows that belong to a process:

Process XYZ window handles, displayed in tree form just like Spy++ gives me:

A
  B
  C
     D
E
F
  G
  H
  I
  J
     K

I can get the process, and the MainWindowHandle property points to the handle for window F. If I enumerate the child windows using I can get a list of window handles for G through K, but I can't figure out how to find the window handles for A through D. How can I enumerate windows that are not children of the handle specified by MainWindowHandle of the Process object?

To enumerate I'm using the win32 call:

[System.Runtime.InteropServices.DllImport(strUSER32DLL)]
            public static extern int EnumChildWindows(IntPtr hWnd, WindowCallBack pEnumWindowCallback, int iLParam);

解决方案

Pass IntPtr.Zero as hWnd to get every root window handle in the system.

You can then check the windows' owner process by calling GetWindowThreadProcessId.

 
精彩推荐
图片推荐