def start

      command_line = name
      command_line = name + ' ' + parameters if parameters

      # returns a struct, raises an error if fails
      process_info = Process.create(
         :command_line => command_line,
         :close_handles => false,
         :creation_flags => Process::DETACHED_PROCESS
      )
      @pid = process_info.process_id
      @thread_id = process_info.thread_id
      process_handle = process_info.process_handle
      thread_handle = process_info.thread_handle

      # wait for process
      ret = WaitForInputIdle(process_handle, (create_process_timeout * 1000))

      # done with the handles
      CloseHandle(process_handle)
      CloseHandle(thread_handle)

      raise_error "start command failed on create_process_timeout" if ret == WAIT_TIMEOUT
      raise_error "start command failed while waiting for idle input, reason unknown" unless (ret == 0)
      @pid
    end
def start

      command_line = name
      command_line = name + ' ' + parameters if parameters

      # returns a struct, raises an error if fails
      process_info = Process.create(
         :command_line => command_line,
         :close_handles => false,
         :creation_flags => Process::DETACHED_PROCESS
      )
      @pid = process_info.process_id
      @thread_id = process_info.thread_id
      process_handle = process_info.process_handle
      thread_handle = process_info.thread_handle

      # wait for process
      ret = WaitForInputIdle(process_handle, (create_process_timeout * 1000))

      # done with the handles
      CloseHandle(process_handle)
      CloseHandle(thread_handle)

      raise_error "start command failed on create_process_timeout" if ret == WAIT_TIMEOUT
      raise_error "start command failed while waiting for idle input, reason unknown" unless (ret == 0)
      @pid
    end
@example initialize an application on the path

   app = Application.new :name => "calc"

 @example initialize with relative DOS path

   app = Application.new :name => "binaries\\mybinary.exe"

 @example initialize with full DOS path

   app = Application.new :name => "\\windows\\system32\\calc.exe"

 @example initialize with logging to file at the default WARN level  (STDOUT logging is the default)

   app = Application.new :name => "calc", :logger_logfile => 'log/calc.log', :logger_trunc => false

 @example initialize with logging to file at DEBUG level

   include Autogui::Logging
   app = Application.new :name => "calc", :logger_logfile => 'log/calc.log', :logger.level => Autogui::Logging::DEBUG

 @example initialize without logging to file and turn it on later

   include Autogui::Logging
   app = Application.new :name => "calc"
   logger.logfile = 'app.log'

 @param [Hash] options initialize options
 @option options [String] :name a valid win32 exe name with optional path
 @option options [String] :title the application window title, used along with the pid to locate the application main window, defaults to :name
 @option options [Number] :parameters command line parameters used by Process.create
 @option options [Number] :create_process_timeout (10) timeout in seconds to wait for the create_process to return
 @option options [Number] :main_window_timeout (10) timeout in seconds to wait for main_window to appear
 @option options [String] :logger_trunc (true) truncate the logger logfile at logfile initialization
 @option options [String] :logger_logfile (nil) initialize logger's output filename
 @option options [String] :logger_level (Autogui::Logging::WARN) initialize logger's initial level

 Start up the binary application via Process.create and
 set the window focus to the main_window

 @raise [Exception] if create_process_timeout exceeded
 @raise [Exception] if start failed for any reason other than create_process_timeout

 @return [Number] the pid