OCX and PythonWin....
Mark Hammond
MHammond at skippinet.com.au
Thu Aug 26 00:50:22 EDT 1999
[cc'd to poster]
Bruce Dodson wrote in message
>On a similar subject. I was experimenting with MapObjects (an ActiveX
>control) and PythonWin. It seems that every time I load it, PythonWin
>crashes on exit (access violation or something). I tried generating a
quick
>AppWizard test in VC++, and had no such problems there. Also no problems
in
>VB, of course.
This is almost certainly due to one or both of:
* The COM object is still alive. pythoncom._GetInterfaceCount() must return
zero before you can safely exit.
* You need to call pythoncom.CoUninitialize()
>There is some benefit to this pain. I am slowly coming to grips with the
>way PythonWin wraps MFC. A light turned on as I was writing this and
>realized why the docs talk about PyCMDIChildWnd while the examples derive
>from things like MDIChildWnd, why the latter isn't mentioned in the help
>file whereas the former can't be found in the object browser. But it's
>6:00am. After a good morning's sleep I will probably have forgotten what I
>learned. :-)
This is tricky and not obvious. The PyCMDIChildWnd is a Python _type_,
implemented in win32ui.pyd. Unfortunately you can not derive from a Python
type, only a Python class. So a framework has been put in place that allows
you to use the Python class (eg pywin.mfc.window.MDIChildWnd) as if it were
the PyCMDIChildWnd type.
This is vaguely documented somewhere, but I can't recall where and there are
still 1000 unread messages in this newsgroup for me to get through :-)
Mark.
More information about the Python-list
mailing list