How do I hook into Win32COM Notifications?

Karl Putland kputland at
Mon Mar 20 20:24:36 CET 2000

Try something like this...

class MySWEvents:
    def OnFileSave(self, <<other args>>):

sw = win32com.client.DisptchWithEvents('Solidworks', MySWEvents)

Go to Mark Hammond's starship site and get his presentation from SPAM8, it
covers COM events


----- Original Message -----
From: "William Wicker" < at>
Newsgroups: comp.lang.python
To: <python-list at>
Sent: Monday, March 20, 2000 11:40 AM
Subject: How do I hook into Win32COM Notifications?

> I'm playing with Python as a scripting language for SolidWorks, a 3D
> CAD program. Solidworks has a COM interface for VBx that Python hooks
> into quite well.
> As part of the COM interface, SolidWorks exposes some notifications
> that signal certain events of interest (file about to save, etc.).
> Looking through the pygen type library code shows me some commented
> out 'function prototypes' that look like they hook onto these
> notifications.
> I don't completely (at all) understand how I can take advantage of
> this, though. Modifying the pygen-created file seems like an
> extraordinarily bad idea. The object hierarchy uses a class - coclass
> design that is also strange to me.
> Any suggestions? Pointers to documentation cheerfully accepted.
> I've already read through the Python Win32 book and attempted to study
> the Microsoft COM documentation (vols 1 & 2).
> Thanks!
> --

More information about the Python-list mailing list