I'm trying to minimize internet explorer after starting. If i don't have any window before then it works fine. and if i already have instance of IE. then it doesn't minimize .
ProcessStartInfo startInfo = new ProcessStartInfo("IExplore.exe");
startInfo.WindowStyle = ProcessWindowStyle.Minimized;
string sub;
startInfo.Arguments = "www.google.com";
Process.Start(startInfo);
2 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Posted Jun 29, 2016, 9:53 AM
ali tuncerPosted Jun 28, 2016, 12:12 AM
you can use Windows API, ShowWindow or ShowWindowAsync function
public static extern int ShowWindow(int hwnd, int ncmd);
public static void MinimizeWindow(Process process)
{
try
{
ShowWindow(process.MainWindowHandle.ToInt32(), 2);
}
catch (Exception e)
{
//log exception
}
}