Author Topic: Start a process in minimized state  (Read 1442 times)

bachphi

  • Hero Member
  • *****
  • Posts: 671
    • View Profile
Start a process in minimized state
« 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
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Start a process in minimized state
« Reply #1 on: June 11, 2020, 11:47:54 PM »

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


bachphi

  • Hero Member
  • *****
  • Posts: 671
    • View Profile
Re: Start a process in minimized state
« Reply #2 on: June 12, 2020, 07:24:49 AM »
That is awesome!
I know you can do it, Godra :=). Thank you.
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================