C# を使用して、ブラウザーをポップ アンダーとして開くようにしようとしています。基本的に、ユーザーがブラウザーを起動したことを検出しています。その直後に、ユーザーが開いたウィンドウの下にある新しいブラウザー ウィンドウを開きたいと考えています。これが私がこれまでに持っているものです:
url = "example.com";
Process[] pname = Process.GetProcessesByName("chrome");
if (pname.Length == 0) // if the user didn't start chrome
{
chrome = false;
}
else // if chrome is running
{
if (!chrome) // if the browser wasn't opened before and it was opened just now.
{
Process process = new Process();
process.StartInfo.FileName = "chrome";
process.StartInfo.Arguments = url;
process.StartInfo.WindowStyle = ProcessWindowStyle.Minimized;
process.Start();
//Process.Start("chrome", url);
}
chrome = true;
}
ただし、これにより、新しいウィンドウで開いたり、新しいタブで開いたりすることがあります。おそらく、ブラウザなどを起動する別の方法を使用する必要がありますか? ありがとう!