我正在做一个在面板中嵌入另一个程序的项目。我得到了这个工作,但我似乎无法将窗口放在表单内。
图片:
到目前为止,我正在使用 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 事件。