Thanks for the reply, Graham.  As near as I can tell, the page you mention
on the Microsoft site has *most* of the interfaces, but not all of them
(thanks, Microsoft...)  I couldn't figure out which interfaces to use for
submit and reset buttons and a few others.  So one of the things I've been
trying to figure out is how to get Ruby to tell me which interfaces a
particular element supports.  I know the
IConnectionPointContainer::EnumConnectionPoints method in C++ will get me
that info, but I don't know how to call it from WIN32OLE.  Things are
getting desperate; I might have to resort to using VB! :-)

Will

"Graham Jenkins" <gjenkins / xchanging.com> wrote in message
news:e249d8e7.0410070419.113506fc / posting.google.com...
> The HTMLElementEvents2 interface appears to be supported by
> "non-functional" elements such as SPAN, DIV, P. See
>
http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/mshtml/reference/events/events.asp
> for other interfaces - such as HTMLAnchorEvents.
>
> ie.document.all.each { |element|
>     if element.tagName == 'A'
>         ev = WIN32OLE_EVENT.new(element, 'HTMLAnchorEvents')
>         ev.on_event {|*args|
>             p args
>         }
>     end
> }
>
> "Will Gwaltney" <will.gwaltney / sas.com> wrote in message
news:<ck13hq$fog$1 / license1.unx.sas.com>...
> > I'm using WIN32OLE_EVENT to set up some event handlers on various DHTML
> > elements in Internet Explorer, and I'm having a bit of trouble
identifying
> > the right event dispinterfaces to use.  The Microsoft online
documentation
> > is less than helpful; they claim that you can use the HTMLElementEvents2
> > interface on most all the HTML elements you care about, but I'm getting
the
> > following when I try:
> >
> > interface not found
> >     HRESULT error code:0x80004002
> >       No such interface supported
> >
> > Here's a code skeleton that outlines what I'm trying to do:
> >
> > ---------------- (snip) -----------------------
> >
> > require 'win32ole'
> >
> > ie = WIN32OLE.new('InternetExplorer.Application')
> >
> >      .
> >      .
> >      .
> >  insert code to display a web page here...
> >      .
> >      .
> >      .
> >
> > elements =  ie.document.all
> > elements.each do |element|
> >      ev = WIN32OLE_EVENT.new(element, 'HTMLElementEvents2')
> >       .
> >       .
> >       .
> >      assign event handlers here
> >       .
> >       .
> >       .
> > end
> >
> > ---------------- (snip) -----------------------
> >
> > And here's the URL for the Microsoft documentation that makes the claims
> > about the HTMLElementEvents2 interface:
> > http://msdn.microsoft.com/workshop/browser/mshtml/tutorials/sink.asp
> >
> > What am I missing?  Do I have to somehow massage the element into a
> > different object that will handle the HTMLElementEvents2 interface?  Or
> > should I be using another interface entirely?  (BTW, is there any way in
> > WIN32OLE to figure out which interfaces an object supports?)
> >
> > Any help will be much appreciated!
> >
> > Will Gwaltney
> > SAS Institute