title: Start a program using subprocess with all windows hidden
body: <p>I'm using subprocess on Windows to start IrfanView to convert a TIFF file to a PDF using command line switches.</p>
  
  <p>I'm working through a few folders of TIFFs and am calling the command for each file. When saving the PDF, IrfanView displays a dialog titled 'Save PDF' to show the progress.</p>
  
  <p>The dialog only shows for a split second but grabs the window focus so the computer can't be used while my script runs in the background. I've tried using <code>subprocess.STARTUPINFO</code> values to hide the window and while the dialog is now hidden it still seems to grab focus.</p>
  
  <p>Here's how I'm calling the IrfanView application.</p>
  
  <pre><code>startup_info = subprocess.STARTUPINFO
  startup_info.dwFlags = 1
  startup_info.wShowWindow = 0
  
  subprocess.call(['i_view32.exe', 'c:/input.tif', '/convert=c:/output.pdf'], startupinfo=startup_info)
  </code></pre>
  
  <p>Does anybody know of a way of starting an application with its windows hidden and without it stealing focus? I'm happy to try a few things - even a wrapper application that then calls IrfanView would do if such a program exists. I'm only needing this for Windows so I don't need a cross-platform solution.</p>
  
  <p>I know I could also use GraphicsMagick or similar instead, but IrfanView does a better job at matching the compression format of the input file so ideally I'd like to get this working using IrfanView.</p>