On 29/01/2013 9:48 AM, Johannes Frank wrote:
Hello,

I am currently working with win32com to access ProgeCAD (an AutoCAD
Clone) Excel and PDFCreator.
Using

comobj = win32com.client.Dispatch('xxx')

  gives me an object through which I can access the COM interface and
thus the underlying program.
Within my program I have to pass this object around to make the
interface accessible whereever it is needed. Closing the program creates
huge problems, as now the object is void.

Instead of getting an object I would prefer to have:

class MyCom(win32com.some_inheritance):
      some code

It's not clear what you mean by "win32com.some_inheritance" given there are an unbounded number of objects that could apply here.

You can obviously encapsulate the COM object inside your class though:

class MyCom:
  def __init__(self, progid):
    self.com = win32com.client.Dispatch(progid)

HTH,

Mark


mycom = MyCom('xxx')

Is something like this possible? If not, is there a reason it was
designed the way it is?

Thank you for your audience.

Kind regards

Johannes

--
Dipl.-Ing. (FH) Johannes-Maria Frank
Bildungsberater
Königsberger-Str. 19b
76139 Karlsruhe
Tel. +49(170) 3833849
e-mail: jmfran...@gmail.com <mailto:jmfran...@gmail.com>


_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to