Patches item #8437, was opened at 2007-02-05 02:35
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1700&aid=8437&group_id=426

>Category: Widget (example)
Group: v1.8.x
Status: Open
Resolution: None
Priority: 3
Submitted By: Mikael Pahmp (mikaelpahmp)
Assigned to: Nobody (None)
Summary: Added method ole_query_interface to WIN32OLE

Initial Comment:
OLE Automation objects may have multiple dispatch interfaces. This new method allows switching to alternative interfaces than the default.

----------------------------------------------------------------------

Comment By: Masaki Suketa (suke)
Date: 2007-02-06 04:42

Message:
Thank you. I understand why this new method is needed. At first, I'll test it and add the method to ruby trunk(the developer version, Ruby 1.9.0 or later). Sorry, but I'm not going to add the method to the next Ruby 1.8.6. Because Ruby 1.8.6 will be code freeze on 2007-02-15. I don't have enough time to test it. 

And, I'll update Win32OLE in Ruby 1.8.x to fix the bugs. But I'm not intend to update Win32OLE in Ruby 1.8.x to add new features. 

Thank you for your patch and quick and kind reply.

----------------------------------------------------------------------

Comment By: Mikael Pahmp (mikaelpahmp)
Date: 2007-02-05 06:56

Message:
It is possible for an automation class to have multiple 
dispinterfaces. When you do WIN32OLE.new you always get 
the default dispinterface of the object. To switch to 
another dispinterface you need to call QueryInterface with 
the desired interface IID.

E.g. when using the automation model for Visual Studio 8 
(2005), and fetch the Solution object, you get a handle to 
the Solution dispinterface. But this object also has a 
Solution2 dispinterface with new methods. To use it you 
should do QueryInterface for the Solution2 interface.

dte2 = WIN32OLE.new('VisualStudio.DTE.8.0')
solution = dte2.Solution
solution2 = solution.ole_query_interface('FA238614-FBB1-
4314-A7F7-49AE8BB6C6BA')

In C# this is done through a cast expression:
  Solution2 soln = (Solution2)dte2.Solution
But this translates to QueryInterface in the background.


----------------------------------------------------------------------

Comment By: Masaki Suketa (suke)
Date: 2007-02-05 05:02

Message:
I would like to know why you need this new method.
Could you show me more detail situation?

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1700&aid=8437&group_id=426