From: Will Gwaltney Date: 2004-10-08T22:09:46+09:00 Subject: Re: How to determine supported dispinterfaces for WIN32OLE object? Hi Paul, Funny you should ask! I'm doing pretty much the same thing you're planning to do. I'm hoping to get permission to open-source my code in the next week or so; I'll drop you a line when I do. The script recorder certainly won't be finished then, but any help anyone wanted to give would be most appreciated. BTW, I think I've come up with a way to figure these interfaces out. Unfortunately, it doesn't involve ruby. :-( I'm going to put together an HTML page with all the controls I care about, then run it through a python program that will output all the connection points for those controls. Then I'll use the discovered interfaces in the ruby-based script recorder. Python's COM support includes low-level stuff like QueryInterface that I haven't been able to figure out with WIN32OLE. Any port in a storm, I guess... :-) Will "Paul" wrote in message news:4ee21163.0410071902.7c89b437@posting.google.com... > Will, can I ask what you aredoing with these interfaces? Im working on > a new version of some code that we use to test web applications via > IEs OLE interface and DOM. > One of the things Im hoping to do is a script recorder, and these > events would be essential in letting me recoed a users actions > > Thanks > > Paul > > > "Will Gwaltney" wrote in message news:... > > 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" 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" wrote in message > > news:... > > > > 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