I tried this:
ProcessStartInfo psi = new ProcessStartInfo("https://stackoverflow.com/");
psi.RedirectStandardOutput = false;
psi.WindowStyle = ProcessWindowStyle.Hidden;
psi.UseShellExecute = false;
Process.Start(psi);
But i'm getting exception on the line Process.Start(psi);
Win32Exception The system cannot find the file specified
If i change the line psi.UseShellExecute = true; Then it's working but it dosen't hide the window.
I want that when it's opening the broswer for example to https://stackoverflow.com/ the user will not see the window at any time but that the window will still be opened. It's not to close but hiding it.
Tried to google but didn't find a working solution.
The Win32Exception message:
System.ComponentModel.Win32Exception was unhandled
HResult=-2147467259
Message=The system cannot find the file specified
Source=System
ErrorCode=-2147467259
NativeErrorCode=2
StackTrace:
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at CuteDadyImages.Form1.OpenBroswerTab() in d:\C-Sharp\test\Form1.cs:line 155
at CuteDadyImages.Form1..ctor() in d:\C-Sharp\test\Form1.cs:line 55
at CuteDadyImages.Program.Main() in d:\C-Sharp\test\Program.cs:line 35
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: