[python-win32] COM ? QueryInterface ?

Mantila Juhani Juhani.Mantila@novogroup.com
Fri, 26 Apr 2002 13:29:34 +0300


Hi,
I'm new to PythonCom - how in detail can I QI, if the object
supports more than one interface ?
I hacked the PyCOMVBTest.Tester to implement my IFooIntf which
I wrote into the same vbproject (DLL). In VB all is visible:

' cls to test hacked tester
Option Explicit

Private mTester As PyCOMVBTest.Tester

Private Sub Class_Initialize()
    Dim iFoo As PyCOMVBTest.IFooIntf
    Set mTester = New PyCOMVBTest.Tester
    Set iFoo = mTester
    iFoo.DoSomething "foo"
    Dim bOk As Boolean
    bOk = iFoo.StopDoimg()
End Sub

Then I ran makepy, of course.

In Python I don't find the way to use IFooIntf ????
I tried inside the interactive session:

>>> o = win32com.client.Dispatch("PyCOMVBTest.Tester")
>>> dir(o)
['CLSID', 'DoCallbackSafeArraySizeFail', 'DoSomeCallbacks', 'GetStructFunc',
'IncrementIntegerParam', 'IncrementVariantParam', 'MakeStructArrayProperty',
'PassIntByRef', 'PassIntByVal', 'PassSAFEARRAY', 'PassSAFEARRAYVariant',
'SetStructSub', 'SetVariantProperty', 'TakeByRefObject', 'TakeByValObject',
'_ApplyTypes_', '__cmp__', '__doc__', '__getattr__', '__init__',
'__module__', '__repr__', '__setattr__', '_get_good_object_',
'_get_good_single_object_', '_oleobj_', '_prop_map_get_', '_prop_map_put_']
>>> dir( o._oleobj_ )
['GetIDsOfNames', 'GetTypeInfo', 'GetTypeInfoCount', 'Invoke',
'InvokeTypes', 'QueryInterface']
>>> 

But I don't find out what would be the correct argument to
o._oleobj_.QueryInterface(),
accutally I don't feel that I should use that one at all,
and o doesn't implement QueryInterface like the manuals seem to say ???

Out and lost ... 

Juhani Mantila

Finland is my home.