AdvancedHMI Software

General Category => Open Discussion => Topic started by: bachphi on June 02, 2020, 08:38:36 AM

Title: Start a process in minimized state
Post by: bachphi on June 02, 2020, 08:38:36 AM
I have the code below to start a process in minimized state. It does work
Code: [Select]
            Dim psi As New ProcessStartInfo("notepad")
            psi.WindowStyle = ProcessWindowStyle.Minimized
            Process.Start(psi)

I want to combine them into one line, it start the process but not in minimized state. how do I fix this? TIA

Code: [Select]
Process.Start("notepad").StartInfo.WindowStyle = ProcessWindowStyle.Minimized
Title: Re: Start a process in minimized state
Post by: Godra on June 11, 2020, 11:47:54 PM

Code: [Select]
  Process.Start(New ProcessStartInfo("notepad") With {.WindowStyle = ProcessWindowStyle.Minimized}) 

Title: Re: Start a process in minimized state
Post by: bachphi on June 12, 2020, 07:24:49 AM
That is awesome!
I know you can do it, Godra :=). Thank you.