WIN32OLE in ruby windows one click installer

Hello,

I am new to ruby for programming win32ole. I install ruby on windows
using ruby one click installer windows version 1.8.5-21. I check the
win32ole.c inside the src/ruby-1.8.5/ext/win32ole directory and the
version shows in the file is only version 0.6.6. But I found in the ruby
trunk the the current win32ole version is 0.9.2.

My question is how do I check my win32ole ext for my current ruby
installer?
How do I compile with the newer version? I can compile my current source
using:
ruby extconf.rb
nmake
nmake install
But it doesn't work with the latest version of win32ole I downloaded. It
has errors when I try to compile win32ole version 0.9.2.

The second question is I am having problem on using my current win32ole
ext, I am suspecting it could be the version is too old already.Is it
any workaround for this? I want to run the following function generate
using olegen.rb.

  # VOID FindAllAvmc
  # method FindAllAvmc
  # DeviceInfo,DeviceInfo arg0 --- avmcList [OUT]
  def FindAllAvmc(arg0)
    ret = @dispatch._invoke(2, [arg0], [VT_BYREF|VT_ARRAY|VT_DISPATCH])
    @lastargs = WIN32OLE::ARGV
    ret
  end

The cpp for the function is :
STDMETHODIMP Avmc::FindAllAvmc(SAFEARRAY **avmcList)
// avmcList is array of structures: devinfo

When I try to run:
C:\ruby\src\ruby-1.8.5\ext\win32ole\sample>irb
irb(main):001:0> require 'avmc'
=> true
irb(main):002:0> avmc = AvmcIfc_Avmc_1.new
=> #<AvmcIfc_Avmc_1:0x2efe488 @dispatch=#<WIN32OLE:0x2efe438>,
@progid="AvmcIfc.
Avmc.1", @clsid="{41BDBDFC-A848-4523-A149-ADD3AE1E6D84}">
irb(main):003:0> dev = []
=> []
irb(main):004:0> avmc.FindAllAvmc(dev)
WIN32OLERuntimeError: _invoke
    OLE error code:0 in <Unknown>
      <No Description>
    HRESULT error code:0x80020005
      Type mismatch.
        from ./avmc.rb:39:in `_invoke'
        from ./avmc.rb:39:in `FindAllAvmc'
        from (irb):4
irb(main):005:0>
irb(main):005:0> dev = 0
=> 0x00
irb(main):006:0> avmc.FindAllAvmc(dev)
TypeError: wrong argument type Fixnum (expected Array)
        from ./avmc.rb:39:in `_invoke'
        from ./avmc.rb:39:in `FindAllAvmc'
        from (irb):6
irb(main):007:0>

Any idea on how to solve this problem? I am wonder the newer version of
win32ole will solve this problem. Seems like the new version include the
WIN32OLE_VARIANT .

Thanks in advance.

···

--
Posted via http://www.ruby-forum.com/.

Hello,

···

In message "WIN32OLE in ruby windows one click installer" on 07/02/04, shin guey <sgwong513@hotmail.com> writes:

How do I compile with the newer version? I can compile my current source
using:
ruby extconf.rb
nmake
nmake install
But it doesn't work with the latest version of win32ole I downloaded. It
has errors when I try to compile win32ole version 0.9.2.

The Win32OLE version 0.9.2 comes with Ruby 1.9.0 (or later).
And the Ruby version of ruby trunk is 1.9.0.
You can't compile Win32OLE version 0.9.2 with Ruby 1.8.5.
You need Ruby 1.9.0 to compile Win32OLE version 0.9.2.

  Regards,
  Masaki Suketa

Masaki Suketa wrote:

Hello,

How do I compile with the newer version? I can compile my current source
using:
ruby extconf.rb
nmake
nmake install
But it doesn't work with the latest version of win32ole I downloaded. It
has errors when I try to compile win32ole version 0.9.2.

The Win32OLE version 0.9.2 comes with Ruby 1.9.0 (or later).
And the Ruby version of ruby trunk is 1.9.0.
You can't compile Win32OLE version 0.9.2 with Ruby 1.8.5.
You need Ruby 1.9.0 to compile Win32OLE version 0.9.2.

  Regards,
  Masaki Suketa

Hi,

From the latest version, it shows that it has fix some VT_ARRAY bugs.
So, do I need the new version to use my com dll?

Anyway, thanks for the quick reply.

Regards,
Shin Guey

···

In message "WIN32OLE in ruby windows one click installer" > on 07/02/04, shin guey <sgwong513@hotmail.com> writes:

--
Posted via http://www.ruby-forum.com/\.

Ruby 1.9.0 is not the stable version, neither Win32OLE(especially
WIN32OLE_VARIANT features).
So, try at your own risk.
I am not sure, but I'm afraid that the new version might not
work in your situation...

Before you try the new version, could you try the following with
the current version?

  def FindAllAvmc(arg0)
    # specify VT_BYREF|VT_ARRAY|VT_VARIANT instead of
    # VT_BYREF|VT_ARRAY|VT_DISPATCH
    ret = @dispatch._invoke(2, [arg0], [VT_BYREF|VT_ARRAY|VT_VARIANT])
    @lastargs = WIN32OLE::ARGV
    ret
  end

  Regards,
  Masaki Suketa

···

In message "Re: WIN32OLE in ruby windows one click installer" on 07/02/04, Shin guey Wong <sgwong513@hotmail.com> writes:

>From the latest version, it shows that it has fix some VT_ARRAY bugs.
So, do I need the new version to use my com dll?

Masaki Suketa wrote:

Before you try the new version, could you try the following with
the current version?

  def FindAllAvmc(arg0)
    # specify VT_BYREF|VT_ARRAY|VT_VARIANT instead of
    # VT_BYREF|VT_ARRAY|VT_DISPATCH
    ret = @dispatch._invoke(2, [arg0], [VT_BYREF|VT_ARRAY|VT_VARIANT])
    @lastargs = WIN32OLE::ARGV
    ret
  end

  Regards,
  Masaki Suketa

I had tried to use the code above. It still not working, I am getting
the same error message:
irb(main):004:0> avmc.FindAllAvmc(dev)
WIN32OLERuntimeError: _invoke
    OLE error code:0 in <Unknown>
      <No Description>
    HRESULT error code:0x80020005
      Type mismatch.
        from ./avmc.rb:39:in `_invoke'
        from ./avmc.rb:39:in `FindAllAvmc'
        from (irb):4

Thanks for you reply. I will try to install the new ruby 1.9 on other
machine and try again. I had been using this dll on C# and python. Both
is working fine. May be I also need to look into the source code...but I
am really not familiar with windows com dll programming. It seems like
too many specification on it.

Regards,
Shin Guey

···

--
Posted via http://www.ruby-forum.com/\.

Sorry for being too late to reply.
And I had not noticed important thing to ask you.

···

In message "Re: WIN32OLE in ruby windows one click installer" on 07/02/06, Shin guey Wong <sgwong513@hotmail.com> writes:

Thanks for you reply. I will try to install the new ruby 1.9 on other
machine and try again. I had been using this dll on C# and python. Both
is working fine. May be I also need to look into the source code...but I
am really not familiar with windows com dll programming. It seems like
too many specification on it.

How can I get the dll(source code)?
Using the dll, I'd like to investigate this problem.

  Regards,
  Masaki Suketa