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