如何为 SetParent 取消停靠游戏 Window
How to undock Game Window for SetParent
大家好。
[DllImport("user32.dll")]
public static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
public void DockAllNote(System.Windows.Forms.Panel panel)
{
Process[] MultiClients = Process.GetProcessesByName("notepad");
foreach (Process Client in MultiClients)
{
hWndOriginalParent = Client.MainWindowHandle;
SetParent(Client.MainWindowHandle, panel.Handle);
panel.Refresh();
}
}`enter code here`
在上面的代码中工作。我想取消停靠记事本 windows.
public void UndockNoteAll(System.Windows.Forms.Panel panel)
{
Process[] MultiClients = Process.GetProcessesByName("notepad");
foreach (Process Client in MultiClients)
{
SetParent(Client.MainWindowHandle, IntPtr.Zero);
panel.Refresh();
}
}
我试过这个取消停靠代码,但取消停靠没有用。记事本留在面板上。如何取消 window?一年前尝试使用 IntPtr.Zero 取消停靠。我不记得密码是什么了。
抱歉英语不好
谢谢
已解决。
IntPtr DockedHandle = IntPtr.Zero;
IntPtr OrjinalHandle = IntPtr.Zero;
//Dock
OrjinalHandle = process.MainWindowHandle
DockedHandle = SetParent(process.MainWindowHandle, panel.Handle);
//Undock
SetParent(OrjinalHandle, DockedHandle);
大家好。
[DllImport("user32.dll")]
public static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
public void DockAllNote(System.Windows.Forms.Panel panel)
{
Process[] MultiClients = Process.GetProcessesByName("notepad");
foreach (Process Client in MultiClients)
{
hWndOriginalParent = Client.MainWindowHandle;
SetParent(Client.MainWindowHandle, panel.Handle);
panel.Refresh();
}
}`enter code here`
在上面的代码中工作。我想取消停靠记事本 windows.
public void UndockNoteAll(System.Windows.Forms.Panel panel)
{
Process[] MultiClients = Process.GetProcessesByName("notepad");
foreach (Process Client in MultiClients)
{
SetParent(Client.MainWindowHandle, IntPtr.Zero);
panel.Refresh();
}
}
我试过这个取消停靠代码,但取消停靠没有用。记事本留在面板上。如何取消 window?一年前尝试使用 IntPtr.Zero 取消停靠。我不记得密码是什么了。
抱歉英语不好 谢谢
已解决。
IntPtr DockedHandle = IntPtr.Zero;
IntPtr OrjinalHandle = IntPtr.Zero;
//Dock
OrjinalHandle = process.MainWindowHandle
DockedHandle = SetParent(process.MainWindowHandle, panel.Handle);
//Undock
SetParent(OrjinalHandle, DockedHandle);