[Python.NET] AxHost & IDispatch
brian at zope.com
Sun Apr 25 22:53:37 EDT 2004
> I've got a python script that I want to create a C# GUI for. I'd like to
> have a web browser control on the form that I can control from
> python. This
> is not too difficult - just drop a WebBrowser control on the form
> and create
> a public property to expose the control.
> The problem is that .net is wrapping the control (AxHost etc) and not all
> the methods are exposed (e.g. Document.all.tags does not work...)
> Can I get the control's IDispatch and use late-binding? If so how????
> If I cant can I create the activex control from python and 'place' it on a
> specific form (given a HWND)? Any examples of manually creating
> and placing
> a activeX control?
Hi Andre -
I'm not a real expert on interop stuff, but I'd suggest running
aximp.exe or tlbimp.exe to generate a wrapper assembly from the
dll that implements the WebBrowser control. The wrapper assembly
should expose everything in a way that Python will be able to use
Then you should be able to instantiate the control via the wrapper
assembly from Python (or from C# for that matter), set it as your
control property and drive it from Python.
I'm guessing that VStudio.NET is using some kind of shortcut
involving a RCW or something when you drop a control onto a form
in the gui.
Hope this helps!
Brian Lloyd brian at zope.com
V.P. Engineering 540.361.1716
Zope Corporation http://www.zope.com
More information about the PythonDotNet