From: Luis Lavena Date: 2010-01-20T23:34:22+09:00 Subject: [ruby-core:27634] [Bug #2618] Win32OLE RuntimeError due CoInitialize not being called Bug #2618: Win32OLE RuntimeError due CoInitialize not being called http://redmine.ruby-lang.org/issues/show/2618 Author: Luis Lavena Status: Open, Priority: Normal Category: ext, Target version: 1.9.x ruby -v: ruby 1.9.1p376 (2009-12-07 revision 26041) [i386-mingw32] A user reported to Ruby-Talk and RubyInstaller mailing list some issues using ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-mingw32] http://groups.google.com/group/rubyinstaller/browse_thread/thread/e5e47aabf09aff98 I could reproduce the issue across multiple versions of 1.9.1 and with close-up-to-date version of 1.9.2dev: http://groups.google.com/group/rubyinstaller/msg/dae727305e57ba6d Simple test script: http://pastie.org/786354

require 'win32ole'

t = Thread.new do
  begin
    ie = WIN32OLE.new( "InternetExplorer.Application" )
    ie.visible = true
    ie.navigate( "http://google.com" )
    puts "OK"
  rescue Exception => e
    puts e.class
    puts e
    puts e.backtrace
  end
end

t.join
Generates this:
ruby 1.9.1p376 (2009-12-07 revision 26041) [i386-mingw32] 

WIN32OLERuntimeError 
failed to create WIN32OLE object from `InternetExplorer.Application' 
    HRESULT error code:0x800401f0 
      CoInitialize has not been called. 
t.rb:5:in `initialize' 
t.rb:5:in `new' 
t.rb:5:in `block in 
' ruby 1.9.1p376 (2009-12-07 revision 26041) [i386-mswin32] WIN32OLERuntimeError failed to create WIN32OLE object from `InternetExplorer.Application' HRESULT error code:0x800401f0 CoInitialize has not been called. t.rb:5:in `initialize' t.rb:5:in `new' t.rb:5:in `block in
' ruby 1.9.2dev (2010-01-02 trunk 26229) [i386-mingw32] WIN32OLERuntimeError failed to create WIN32OLE object from `InternetExplorer.Application' HRESULT error code:0x800401f0 CoInitialize has not been called. t.rb:5:in `initialize' t.rb:5:in `new' t.rb:5:in `block in
'
Both mswin32 and mingw32 generates the same issue. ---------------------------------------- http://redmine.ruby-lang.org