我正在用 C# 编写一个应用程序,它需要将自己的一个窗口附加到另一个进程拥有的窗口。我尝试使用 Windows api 中的 SetParent 函数,但它似乎不起作用。有没有办法做到这一点?
[DllImport("user32.dll", SetLastError = true)]
private static extern int SetParent(int hWndChild, int hWndNewParent);
private void AttachWindow(int newParent) {
SetParent(this.Handle, newParent);
}