Link to home
Start Free TrialLog in
Avatar of Ragine
Ragine

asked on

How to embed a program within my own.

Hello Experts, I'm trying to embed a program within my form/panel. So maybe embed notepad within my panel, and un-embed it back to its original spot. I've googled it and got a bit of understanding but still need more help.
SOLUTION
Avatar of Luis Pérez
Luis Pérez
Flag of Spain image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Ragine
Ragine

ASKER

Thank you guys, but still need a bit of help. How do I un-embed the program? I'm using 'emoreau' answer.

private const int WM_SYSCOMMAND = 274;
        private const int SC_MAXIMIZE = 61488;

        private void button1_Click(object sender, EventArgs e)
        {
            //Run Notepad application inside Panel1 control
            Process proc = null;
            proc = Process.Start("Notepad.exe");
            proc.WaitForInputIdle();
            SetParent(proc.MainWindowHandle, this.iTunesPanel.Handle);
            SendMessage(proc.MainWindowHandle, WM_SYSCOMMAND, SC_MAXIMIZE, 0);
        }

Open in new window

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Ragine

ASKER

Yeah that works too, or just use GetDesktopWindow(); Either way works well. Thank you all for your help. I think >>emoreau<< was the best answer, simple and very useful.