I got a working code for this in C#
https://drive.google.com/file/d/1x_N01-ECAUW1M8ZxJrgNCtCeS31Tuq2O/view?usp=sharing
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace WindowsFormsApp1
{
public partial class Form1 : Form
{
Process parentedProcess;
public Form1()
{
InitializeComponent();
}
private void Cmdshowcasparcgwindow_Click(object sender, EventArgs e)
{
try
{
Process[] p1 = Process.GetProcessesByName("casparcg");
int iprocess;
for (iprocess = 0; iprocess <= p1.GetUpperBound(0); iprocess++)
{
if (p1[iprocess].MainWindowTitle == cmbcasparcgwindowtitle.Text)
break;
}
parentedProcess = p1[iprocess];
SetParent(parentedProcess.MainWindowHandle, Panel1.Handle);
SendMessage(parentedProcess.MainWindowHandle, 274, 61488, 0);
}
catch (Exception ex)
{ }
}
[DllImport("user32.dll")]
static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
[DllImport("user32.dll")]
static extern IntPtr SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
private void Cmdoutcasparcgwindow_Click(object sender, EventArgs e)
{
try
{ SetParent(parentedProcess.MainWindowHandle, (IntPtr.Zero)); }
catch (Exception ex)
{ }
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{ try
{ SetParent(parentedProcess.MainWindowHandle, (IntPtr.Zero)); }
catch (Exception ex)
{ }
}
}
}