Am 02.01.2017 um 08:16 schrieb Leonard de Ruijter: > Hello Folks, > > I’m new on this list and have been working with comtypes lately. My > current project is an attempt to implement a Microsoft Remote Desktop > Dynamic Virtual Channel in comtypes. here > <https://blogs.technet.microsoft.com/virtualworld/2007/09/25/dynamic-virtual-channels/> > is a relevant article. > > I’ve created the following typelib: > > import “oaidl.idl”; > import “ocidl.idl”; > import “tsvirtualchannels.idl”; > > [ > uuid(48E31041-DAFB-49AA-B07E-DEAA06E004B5), > version(1.0), > ] > library NVDADVC > { > importlib(“stdole2.tlb”); > [ > uuid(AB1924A9-A608-4C5B-A1CD-A5FC020559F1), > helpstring(“TS plugin Class”) > ] > coclass NVDADVC > { > [default] interface IWTSPlugin; > }; > }; > > I’ve been able to register the comserver as noted in this > <http://starship.python.net/crew/theller/comtypes/server.html> > documentation. > > Now, I have to implement an Initialize method in which I have to create > an IWTSListenerCallback interface and provide a pointer to it. I know > how to create an object client side, but how to do this server side? Is > the comtypes.client involved in this as well? Is there anyone who can > help me out with this?
Short answer (no time for a longer one): You implement a class which implements this interface, just like a normal COM server class: derives from comtypes.COMObject, has a _com_interfaces_ attribute which lists the supported interface(s), in your case at least IWTSListenerCallback. Then create an instance of this class: inst = MyClass() A pointer to the COM interface can be created in this way: inst.QueryInterface(IWTSListenerCallback) which you can use in the Initialize method. Thomas ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ comtypes-users mailing list comtypes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/comtypes-users