IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Python question on dynamic classes
I want to know what members and variables a dynamically created Python class has.

The win32com.client.getevents() function generates a base class with the events of a given COM object, given either ClsID (the 128-bit COM identifier) or ProgID (descriptive name). So, I want to know the interface of the class generated by getevents().

The answer shouldn't require any Win32 COM knowledge since the created class is a normal Python class.

But, for those who are interested, here's a little more background:
I need to catch events from a set of COM objects created by others.

This set of COM objects are contained in a out of process COM server (EXE file), with a base container object (the controller) that can be created by name (ProgID) that holds several other, different COM objects (axes).

I can create the controller using the win32com.client.DispatchWithEvents() funtion, but since the axes already exist, they don't need to be created; all they need is to have an event-handling class (created using getevents() to generate the base class) to be attached to them.

I can get the result I need by finding the ClsID for the COM axis class, and passing this to getevents(). However, I don't like using the ClsID because it can easily change (e.g. it's different for debug and release versions), but the only ProgID I have is for the controller COM object, not the axes COM objects. So, I want to know what getevents() generates when I pass the controller ProgID, since if it generates events for all the classes in the type library, then I should be OK.

Summary:
Python is good stuff so far, although the Win32 COM documentation could be much better.
COM is a typical MS hack job.

Tony
New inspect module looks like it'll work
one thing which is really cool about Python is how interactive it is; it's much more interactive than VB, for example.

Anyway, I found the inspect module and played with it; it seems to fit the bill, although I haven't turned it loose on the COM objects in question.

COM is still a hack.

Tony
     Python question on dynamic classes - (tonytib) - (1)
         inspect module looks like it'll work - (tonytib)

As seen on TV!
27 ms