【发布时间】:2020-03-22 08:21:15
【问题描述】:
我正在寻找如何获取子窗口的句柄并在那里发布消息。
我的代码:
[DllImport("user32.dll", SetLastError = true)]
static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
//This send postmessage to window "192.168.0.94 - Remote Desktop Connection"//
IntPtr hwnd10 = FindWindow(null, "192.168.0.94 - Remote Desktop Connection");
Point location = new Point(636, 324);
PostMessage(hwnd10, WM_MOUSEMOVE, 0, MAKELPARAM(location.X, location.Y));
PostMessage(hwnd10, WM_LBUTTONDOWN, 0x1, MAKELPARAM(location.X, location.Y));
PostMessage(hwnd10, WM_LBUTTONUP, 0, MAKELPARAM(location.X, location.Y));
// But now how can i do the same to child window "Input Capture Window"?
我做了一些研究,发现了 [pageenumchildwindows][1],但不知道如何在我的示例中使用它。
截屏看看我在寻找什么窗口:
【问题讨论】:
-
你可以试试 FindWindowEx。它遍历父窗口的子窗口。您已经获得了父窗口,因此将其传递给此窗口并将名称设置为“输入捕获窗口”:docs.microsoft.com/tr-tr/windows/win32/api/winuser/…
-
你能把它写在 answear 中吗,它应该是什么样子?使用 dllimport 等。
-
我会的。我只是想拥有一个有效的 POC
标签: c# rdp postmessage childwindow