views:

215

answers:

2

I am working on a program using the JACOB project (JAva COm Bridge).

There is a file to open, the entire name is passed along (ex. c:\test\test.xls). In order for JACOB to create a new ActiveXComponent it needs to be passed a ProgID or CLSID. (Such as Excel.Application, or Word.Application, but outside of the MS realm there is also Autocad.Application etc.)

So how can one relate either the file extension or MIME type to a given ProgID or CLSID? Is there another db that I can join to Win32_ProgIDSpecification? Win32_ProgIDSpecification has all the ProgID's.

A: 

Some abstract object you get by CLSID or PROGID can do nothing with filename. It can open file only through some interface methods, which are different in most cases.

For executables, for example, you can pass filename as an argument, but ActiveX object has not such universal ability.

For your case I would create my own “DB” for most widely used objects/apps.

Eugene
A: 

You can check the ProgID that a file extension is associated with in the Windows Registry.

Look under the registry base key HKEY_CLASSES_ROOT for the extension. There will be keys there called ".pdf", ".xls", etc. The default value for the key is the ProgID.

Bernard Darnton