调用第三方程序,指定父窗体

[DllImport("user32.dll")]
        
static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);

        [DllImport(
"user32.dll")]
        
private static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);

        
private void button1_Click(object sender, EventArgs e)
        {
            System.Diagnostics.Process p 
= System.Diagnostics.Process.Start("calc");
            p.WaitForInputIdle();
            SetParent(p.MainWindowHandle, 
this.splitContainer1.Panel2.Handle);
            ShowWindowAsync(p.MainWindowHandle, 
3);
        }
原文地址:https://www.cnblogs.com/kenter/p/2123272.html