Vb.net 移动另一个程序的窗口并删除边框

Vb.net 移动另一个程序的窗口并删除边框,vb.net,setparent,Vb.net,Setparent,我正在做一个项目,在面板中嵌入另一个程序。我让它工作,但我似乎不能把窗口的权利,在形式内 图片: 我正在使用MoveWindow和SetWindowLong,到目前为止运气都不好。。这是我的Onload事件 Dim proc As Process = Process.Start("C:\Nexon\MapleStory\MapleStory.exe", "GameLaunching") proc.WaitForInputIdle() SendMessage(proc.MainWindowHand

我正在做一个项目,在面板中嵌入另一个程序。我让它工作,但我似乎不能把窗口的权利,在形式内

图片:

我正在使用MoveWindow和SetWindowLong,到目前为止运气都不好。。这是我的Onload事件

Dim proc As Process = Process.Start("C:\Nexon\MapleStory\MapleStory.exe", "GameLaunching")
proc.WaitForInputIdle()
SendMessage(proc.MainWindowHandle, WM_SYSCOMMAND2, SC_CLOSE, 0)

System.Threading.Thread.Sleep(5000)
Do
  System.Threading.Thread.Sleep(5000)
Loop Until FindWindow("MaplestoryClass", Nothing)
System.Threading.Thread.Sleep(500)

SetWindowLong(Processes(0).MainWindowHandle, GWL_STYLE, WS_VISIBLE)

MoveWindow(Processes(0).MainWindowHandle, Panel1.Left, Panel1.Top, Panel1.Right, Panel1.Bottom, True)

Dim FHandle As IntPtr
FHandle = FindWindow("MaplestoryClass", Nothing)
SetParent(FHandle, Panel1.Handle)
我需要找到一种方法,等待程序窗口显示,然后执行MoveWindow和SetWindowLong事件

我想我明白了:

[DllImport("user32.dll")] static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
[DllImport("user32.dll")] static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
[DllImport("user32.dll")] static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);

Process p = new Process();
p.StartInfo.FileName = "programPath";
p.Start();
p.WaitForInputIdle();

SetParent(p.MainWindowHandle, Panel1.Handle);
SetWindowLong(p.MainWindowHandle, -16, 0x10000000);
ShowWindow(p.MainWindowHandle, 3);

你试过最大化枫树故事窗口吗?那不起作用,因为它被禁用了