[python-win32] Finding the COM server

Tim Roberts timr at probo.com
Fri Oct 12 19:08:40 CEST 2007


Kevin Patterson wrote:
> Once I've successfully called Dispatch and gotten an object back from
> the COM server, is there a way to determine the path to the exe of the
> COM server where I got the object from?
>
> There are some other DLL's that are not COM servers in the same
> directory as my COM server, and I'm looking for an easy and reliable
> way to know the path to those DLLs.

You can look it up in the registry, which is exactly what
CoCreateInstance does to find the server.

It sometimes takes a bit of cross-referencing.  Take
"Excel.Application", for example.  In HKEY_CLASSES_ROOT,
Excel.Application\CurVer tells me the version is Excel.Application.11.  
Excel.Application.11\CLSID tells me the class is
{00024500-0000-0000-C000-000000000046} 
CLSID\{00024500-0000-0000-C000-000000000046}\LocalServer32 tells me the
handler is c:\Program Files\Microsoft Office\Office11\Excel.exe.

InProcServer32 will be set if it is an in-process DLL.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the python-win32 mailing list