メインアプリの子フォームから .exe を起動しようとしていますが、問題は、他の .exe を開いて作業を終了し (指紋をスキャンして)、終了すると、アプリが最小化されることです。私はこれを試します:
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool SetForegroundWindow(IntPtr hWnd);
void method {
..........more code...........
using (Process proc = new Process())
{
proc.StartInfo.FileName = "WindowsFormsApplication3.exe";
proc.Start();
SetForegroundWindow(proc.MainWindowHandle);
}
............code here..............
}
しかし、それは機能しません。私のメインアプリはフォーカスを失いました。多くの解決策を見つけましたが、どれもうまくいきました。他の .exe も私がやっているアプリです。