The problem I have now is that I can walk through all the desktop windows, and the child windows of those windows, get their hWnds, etc... but Watir will not attach using :hwnd because the attach method calls "attach_browser_window", which in turn calls "find_window", and that method only returns top-level windows. It is not designed to allow me to attach to child windows at all.

I have been trying to figure out how to get a WIN32OLE object for a child window, using WIN32OLE.connect(moniker) or WIN32OLE.new(moniker), so far with no luck. I have no idea what I should use as a "moniker". And I have found no documentation at all for WIN32OLE.connect_unknown.

There MUST be a way to do this. Any insight?

Lonny Eachus
===========

Subject:
Re: [Wtr-general] Embedded Browser and/or SmartCleint
From:
"Charley Baker" <[EMAIL PROTECTED]>
Date:
Thu, 5 Jul 2007 14:43:41 -0600
To:
wtr-general@rubyforge.org
To:
wtr-general@rubyforge.org

My guess is that you could attach to the embedded browser if you can get a handle to the ie instance and then attach to the handle using
ie.attach(:hwnd, handle). You may be able to get a handle by navigating through windows, simalarly to the way it's set up in Watir by using Shell.Application, iterating through windows and finding a window that matches either your title, url or class name. Check out each on class IE for an example.

 I haven't done this before but that would be the general tack I'd take. There are likely better ways, but that'd be my first route. Otherwise you could find the window with Winclicker based on the title and class and pump that into ie.attach or find the child window that's serving the content and use that. Not having done it this is where I'd start and poking around on msdn, there are some good articles on hosting a browser control which might prove useful. Codeproject also has some examples of that.

 win32ole_pp has been of help to me here and there for getting better insight into the ole objects and supported methods.

-Charley


_______________________________________________
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to