You could probably use
SetForegroundWindow function | Microsoft Docs[
^] to bring the window to topmost
Something like
[System.Runtime.InteropServices.DllImport("user32.dll")]
internal static extern int SetForegroundWindow(IntPtr hwnd);
...
void YourMethod() {
ProcessInfo[] procs = null;
if (denizbankProcess == null || (denizProcess != null && denizProcess.HasExited))
{
procs = ProcessCE.GetProcesses();
if (procs.Where(p => p.FullPath.Contains("DotNetDeniz")).Count() > 0)
{
var pid = procs.Where(p => p.FullPath.Contains("DotNetDeniz")).First().Pid;
denizbankProcess = Process.GetProcessById((int)pid);
SetForegroundWindow(denizbankProcess.MainWindowHandle);
}
else
{
var psi = new System.Diagnostics.ProcessStartInfo();
psi.FileName = "\\PocketStore\\WIN_CE\\DotNet\\Deniz\\DotNetDeniz.exe";
denizProcess = Process.Start(psi);
Thread.Sleep(10000);
}
}
}
Note that if the window is minimized, you need to use
ShowWindow function | Microsoft Docs[
^] to restore or maximize the window first.