Hallo,
I need helping adding an existing Interface to an object I dispatched from a COM-server via win32com in Python.
The Code for this in VisualBasic looks like that:
-
Private Obj_1 As Obj1_LIB.Impl_1
-
Private mHelper As Object
-
Private m_applJob As Object
-
Private m_applModul As interface_Module //interface_Module is described in an IDL/TLB-File
-
Private cont As Boolean
-
Private c_applJob As New ApplicationJob.Job
-
-
Set m_Obj_1 = CreateObject("Obj1_LIB.Impl_1")
-
m_Obj_1.Init
-
-
Set mHelper = CreateObject("ModulHelper.Helper")
-
Set m_applJob = CreateObject("ApplicationJob.Job")
-
Set m_applModul = m_applJob
-
-
m_applModul.method1_from_appl_module
-
m_applModul.method2_from_appl_module
These methods (method1/_from_appl_module) are part of the interface loaded from interface_module and not part of the m_applJob-Object. Nevertheless, m_applModul now also supports all methods from the m_applJob-Object.
So how can I do this in Python?
I tried this, which didn't work:
-
import win32com.client
-
Obj_1 = win32com.client.Dispatch("Obj1_LIB.Impl_1")
-
Obj_1.Init()
-
-
ModulHelp = win32com.client.Dispatch("ModulHelper.Helper")
-
applJob = win32com.client.Dispatch("ApplicationJob.Job")
-
-
applJob._oleobj_.QueryInterface("{7DE9DB29-1794-4C3B-95EA-E1324B15BBE6}") ##using the uuid of the interface described in the IDL
-
This says "interface not supported"
I'd appreciate your help in this!