How do I hook into Win32COM Notifications?

Karl Putland kputland at servicemagic.com
Mon Mar 20 14:24:36 EST 2000


Try something like this...

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

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


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

-Karl


----- Original Message -----
From: "William Wicker" <remove.me.wwicker at spectratechnologies.com>
Newsgroups: comp.lang.python
To: <python-list at python.org>
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!
> --
> http://www.python.org/mailman/listinfo/python-list





More information about the Python-list mailing list