WIN32OLE in ruby windows one click installer

S

shin guey

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.
 
M

Masaki Suketa

Hello,

In message "WIN32OLE in ruby windows one click 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 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
 
S

Shin guey Wong

Masaki said:
Hello,

In message "WIN32OLE in ruby windows one click installer"


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
 
M

Masaki Suketa

In message "Re: WIN32OLE in ruby windows one click installer"
So, do I need the new version to use my com dll?

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
 
S

Shin guey Wong

Masaki said:
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
 
M

Masaki Suketa

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"
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top