Frame are used to jump between pages. You could use WindowsFormsHost to host other applications.
Xaml:
<Grid x:Name="test">
</Grid>
Codebehind:
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Threading;
using System.Windows;
using System.Windows.Forms.Integration;
namespace OpenEXEInWpf
{
public partial class MainWindow : Window
{
[DllImport("user32.dll")]
public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
[DllImport("user32.dll", SetLastError = true)]
public static extern int GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32.dll")]
private static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
[DllImport("user32.dll")]
private static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, int uFlags);
public IntPtr _appWin { get; set; }
private Process _childp;
public MainWindow()
{
InitializeComponent();
Loaded += (s, e) => LaunchChildProcess();
}
private void LaunchChildProcess()
{
string exeName = @"C:\**\PreventKeyboardInListview.exe";
var procInfo = new System.Diagnostics.ProcessStartInfo(exeName);
procInfo.WorkingDirectory = System.IO.Path.GetDirectoryName(exeName);
procInfo.WindowStyle = ProcessWindowStyle.Minimized;
_childp = Process.Start(procInfo);
System.Windows.Forms.Panel _pnlSched = new System.Windows.Forms.Panel();
WindowsFormsHost windowsFormsHost1 = new WindowsFormsHost();
windowsFormsHost1.Child = _pnlSched;
test.Children.Add(windowsFormsHost1);
while (_childp.MainWindowHandle == IntPtr.Zero)
{
Thread.Yield();
}
_appWin = _childp.MainWindowHandle;
SetParent(_appWin, _pnlSched.Handle);
}
}
}
The result:
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our [documentation][5] to enable e-mail notifications if you want to receive the related email notification for this thread.
[5]: https://learn.microsoft.com/en-us/answers/articles/67444/email-notifications.html