【发布时间】:2013-03-04 05:51:00
【问题描述】:
一旦应用程序现在用作父应用程序,您将如何从表单中取消挂钩?
[DllImport("user32.dll")]
public static extern int SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
[DllImport("coredll.dll", SetLastError = true)]
private static extern int GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("coredll.dll", SetLastError = true)]
private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
SetParent(setter, this.panel1.Handle);
解开我试过 SetParent(setter, setter);没有运气。
【问题讨论】:
-
我对此并不熟悉,但我会尝试通过在设置新父之前存储它来设置旧父(无论是什么)。
-
嗯抱歉我听不懂
unhook an application from your form- 这是什么意思?就像你将 Chrome 标签页拖到它自己的应用程序中一样?请详细说明:) -
msdn docs on SetParent 说将 parent 设置为 NULL 会将其挂接到桌面。不过没有任何经验
-
异常,intptr 为 null 不可能,(IntPtr)null 没有结果
-
@ploxtic 尝试使用
IntPtr.Zero而不是.Netnull。
标签: c# winforms winapi release