我想在 C# 中创建与 spy++ 相同的函数“查找窗口...”。我尝试过使用 WINAPI 的这个功能:
HWND WINAPI WindowFromPoint(__in POINT Point);
http://msdn.microsoft.com/en-US/library/ms633558.aspx 但我没有到达所有元素,因为它们被禁用或隐藏。
例如,在程序员模式下使用窗口 7 计算器,如果它们被禁用,我无法使用我的程序获取“ABCDE F”,那么 spy++ 可以获取它。
编辑:我试过这个,但它不工作:
[DllImport("user32.dll")]
public static extern ulong GetClassLongPtr(IntPtr hWnd, int nIndex);
[DllImport("user32.dll")]
public static extern IntPtr ChildWindowFromPointEx(IntPtr hWndParent, Win32Point pt, uint uFlags);
IntPtr hWnd = WindowFromPoint(myPoint);
hWnd= ChildWindowFromPointEx(hWnd , myPoint, 0x0000);
myPoint 是我鼠标的位置。
我不熟悉WINAPI,我想你的解释是对我缺乏了解。有可能有一个 ChildWindowFromPointEx 函数的小例子,或者知道我的代码不起作用吗?谢谢你的回答
我尝试创建循环,但似乎句柄在另一个句柄下但不是句柄的子句柄,当键“abcde f”被禁用时,循环总是发送相同的句柄并且没有期望的子句。你有别的想法吗?