Hello, I was able to show the notepad in the Winform by using a panel and inserting it in the form like this code below and using SetParent API:

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

Process proc = Process.Start(
    new ProcessStartInfo()
    {
                                                                                                              //here I put notepad.exe and it works 
        FileName = Environment.GetEnvironmentVariable("windir") + @"\system32\calc.exe", 
        WindowStyle = ProcessWindowStyle.Minimized
    });
            Thread.Sleep(200);

            SetParent(proc.MainWindowHandle, this.panel1.Handle);

My problem is for the calculator, I can't show the Calcultator in the winform it shows me an error.(System.InvalidOperationException)
Thank you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.