Anybody have any Python examples using COM? (re: IUnknown)

Do you have questions about writing plugins or scripts in Python? Meet the coders here.
Post Reply
sofakng
Posts: 8
Joined: Thu Feb 10, 2011 2:26 pm

Anybody have any Python examples using COM? (re: IUnknown)

Post by sofakng » Thu Feb 10, 2011 2:45 pm

I'd like to write a simple plugin that allows switching of the default audio device using Vista and Windows 7.

This was easy to do under XP (using public API calls), but under Vista and Windows 7 it's hidden away in undisclosed DLLs.

Somebody reversed engineered the Windows control panel (sound manager) to find the calls so it's now possible to switch the default audio devices.

Anyways... the methods using COM and the interfaces inherit from IUnknown (not IDispatch).

Does anybody have any examples of doing this in Python? It looks like somebody wrote a Python package called Comtypes to accomplish this exact thing but I'm not sure what I would need to integrate this Python library into EventGhost. (I'm a .NET developer without a lot of experience with Python but if somebody could get me started with this I'm certain I could code the rest...)

stottle
Plugin Developer
Posts: 636
Joined: Sun Apr 26, 2009 10:59 pm

Re: Anybody have any Python examples using COM? (re: IUnkno

Post by stottle » Fri Feb 18, 2011 2:19 am

I haven't used that package, but I tested an import from it by downloading the zip file from sourceforge and and copying the comtypes directory (inside the comtypes-6.2 directory) into the directory my plugin code was in. From there you can try to run the examples from the comtypes documentation from your plugin.

Hope that helps,
Brett

Post Reply