From: Barry Walker Date: 2007-03-03T01:57:18+09:00 Subject: Re: Win32OLE trouble (custom ocx) Masaki Suketa wrote: > Hello, this may not be the answer your question..., I'm just trying to make it work. Any method is fine. require 'win32ole' qp = WIN32OLE.new("QPTnt.ocx") gives the error qptest.rb:2:in `initialize': unknown OLE server: `QPTnt.ocx' (WIN32OLERuntimeError) HRESULT error code:0x800401f3 Invalid class string from qptest.rb:2:in `new' from qptest.rb:2 Soleb shows the PROGID of my QPTnt class is QPTNT.QPTntCtrl.1 So I try: require 'win32ole' qp = WIN32OLE.new("QPTNT.QPTntCtrl.1") s= qp.Version gives the error qptest.rb:3:in `method_missing': Version (WIN32OLERuntimeError) OLE error code:0 in HRESULT error code:0x8000ffff Catastrophic failure from qptest.rb:3 But Version is a method shown in soleb. > If this approach is fail, try to use olegen and _invoke like > as the following. > > require 'win32ole' > include WIN32OLE::VARIANT > obj = WIN32OLE.new("Your.OCX") I tried, require 'win32ole' include WIN32OLE::VARIANT qp = WIN32OLE.new("QPTnt.OCX") s= qp.Version gives ptest.rb:3:in `initialize': unknown OLE server: `QPTnt.OCX' (WIN32OLERuntimeError) HRESULT error code:0x800401f3 Invalid class string from qptest.rb:3:in `new' from qptest.rb:3 and require 'win32ole' include WIN32OLE::VARIANT qp = WIN32OLE.new("QPTNT.QPTntCtrl.1") s= qp.Version gives qptest.rb:4:in `method_missing': Version (WIN32OLERuntimeError) OLE error code:0 in HRESULT error code:0x8000ffff Catastrophic failure from qptest.rb:4 I tried another method, Activate2 with the same results. When I run require 'win32ole' obj = WIN32OLE.new("QPTNT.QPTntCtrl.1") m = obj.ole_method_help("Version") p m.dispid m.params.each do |param| puts "-----" p param.ole_type p param.ole_type_detail p param.optional? end I only get one number on one line. 36 When I run it for the Activate2 (which requires one arguement) method I get: 55 ----- "I4" ["I4"] false It was a year ago I ran the OCX with VBSript and I can't find the code. I just remember that it worked and that it was very cumbersome so I abandon it. As I recall I invoked QPTnt.ocx not QPTNT.QPTntCtrl.1. Thank you so much for your help. -- Posted via http://www.ruby-forum.com/.