[Win32utils-devel] Fwd: IUnknown COM from Ruby

Charley Baker charley.baker at gmail.com
Sat Oct 23 17:48:32 EDT 2010

This is definitely interesting. I don't know about the COM UI
Automation in Win7, but as part of the Watir project, we've had to
hack around this issue some leading to exactly what Bill mentions - a
custom c++ dll and some sorry hacks for win32ole.so. This is obviously
a bit of a problem for switching Ruby versions, though fortunately
only used to grab IE showModalDialog dialogs which is a subset of our
users. I'd be happy to contribute somehow or another, as this has been
on the list of todos to get rid of for a while.



On Sat, Oct 23, 2010 at 1:36 PM, Bill Agee <billagee at gmail.com> wrote:
> On Tue, Oct 19, 2010 at 10:53 PM, Heesob Park <phasis at gmail.com> wrote:
>> Because DbgEng is not a registered COM server, we cannot use WIN32OLE
>> module for this case.
>> And there is no easy way to do this using ruby.
>> Anyway, here is a first trial:
> <snip>
> Hi,
> I wanted to thank you guys for giving some attention to this topic. :)
> The DbgEng problem sounds similar to a situation I was in recently - I
> wanted to use Ruby to try out the new MS UI Automation COM client API on
> Win7.
> This API has a lot of promise for doing UI automation tasks.  But the COM
> object at the heart of it (CUIAutomation) does not implement IDispatch, so I
> found it cannot be used with Ruby WIN32OLE (and similar modules for other
> languages).
> In the end I was able to use Python and comtypes to successfully use the UIA
> COM API (and incidentally, it looks like comtypes is also used by PyDbgEng).
> But a pure Ruby solution would be really convenient.  I was not able to get
> a handle on how to quickly get comtypes-like behavior in Ruby - I guess a
> fair amount of effort will be required to mimic comtypes.
> The vtable/memcpy Ruby Win32::API code posted by Park looks like a nice
> first step in that direction. :)
> As an alternative to a pure-Ruby solution, I found that I could instantiate
> and use an IUnknown COM object via a Ruby C++ extension.  Ben - this might
> be a workaround to investigate if you absolutely have to get something
> working quickly.
> I was able to build such an extension using both MSVC and the Ruby
> DevKit/MinGW.  However, the MinGW solution was more painful since it
> required some header file tweaking, since MinGW did not yet have the UI
> Automation headers from the Win7 SDK.  (DbgEng may not pose the same problem
> though.)
> Thanks
> Bill
> _______________________________________________
> win32utils-devel mailing list
> win32utils-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/win32utils-devel

More information about the win32utils-devel mailing list