COM and CreateObject and inheritence

tiddlerdeja at my-deja.com tiddlerdeja at my-deja.com
Sun Jan 23 14:38:40 EST 2000


I've now used the VB debugger and found that I get 99 returned from my
function bar:

x = c.bar

x now contains 99.

If I try to do anything with x:

MsgBox x

Then VB crashes.

My COM object seems to work fine from Python and Dispatch calls? Are
there other tests I could do to diagnose the problem? Could my
installation of VB be broken?

Any help apprecuated.

In article <86d2dr$a9b$1 at nnrp1.deja.com>,
  tiddlerdeja at my-deja.com wrote:
> I managed to get the HelloWorld COM Python example to work using
> CreateObject in VB. I could not get a Reference to Python.TestServer
so
> that I could:
>
> Dim Test and HelloWorld
>
> Instead I had to:
>
> Dim Test As Object
>
> Is it not possible to get a reference to it?
>
> Also, I tried to create my own test:
>
> foo.py
> -----
>
> class foo:
>     def __init__(self):
>         print 'init'
>
>     def bar(self):
>         return 99
>
> comfoo.py
>
> from foo import *
> class comfoo(foo):
>     _reg_clsid_ = "{3F90DE60-D0F5-11D3-96E4-9A059544BB30}"
>
>     _reg_progid_ = "My.Test"
>
>     _reg_desc_ = "COM Test"
>
>     _public_methods_ = ['bar']
>
>     def __init__(self):
>         print 'cominit'
>
> When I try to call 'bar' in VB it crashes. comfoo is registered and
both
> files are in my python path.
>
> Can someone tell me what I'm doing wrong?
>
> Any help appreciated.
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list