-1

我想要做的是接管另一个正在运行的应用程序并将其附加到我的表单中的面板上,如下所示:

   private void button1_Click(object sender, EventArgs e)
    {
        Process p = Process.Start("notepad.exe");
        Thread.Sleep(500); // Allow the process to open it's window
        SetParent(p.MainWindowHandle, panel1.Handle);
    }

但就我而言,我不会启动应用程序,我将不得不接管现有的、正在运行的进程。

想法?

在此先感谢,丹。

4

1 回答 1

0

试试这个:

foreach (var process in Process.GetProcesses())
{
    if (process.ProcessName == "notepad")
    // or
    //if (process.MainWindowTitle == "Untitled - Notepad")
    {
        SetParent(process.MainWindowHandle, panel1.Handle);
    }
};
于 2015-06-28T13:31:49.723 回答