Identifying application by file extension...

G

Guest

Hi to everybody,

how can I get the application to open a file with a given extension?

I mean, I've a compact framework device and I would like to know the
executable that opens a file given its extension.
E.g. given the extension .html I would like to get the full path of the
browser back since this is the application that opens it.

In other words:
1 - where can I find the association between file extensions and applications?
2 - How do I access it from the code (C#)?

Thanks a lot.

M. & P.
 
J

Joseph Byrns

You can look in the registry

HKEY_CLASSES_ROOT

for example if you look at the default value for .bmp key in
HKEY_CLASSES_ROOT, then find the key with that default value in
HKEY_CLASSES_ROOT again it gives the path of the file.

So just to labour a point:

HKEY_CLASSES_ROOT\.bmp there the value of default is: hpimgview.bmp

so if you now look in HKEY_CLASSES_ROOT\hpimgview.bmp\Shell\Open\Command the
default value there is \Windows\hpimgview.exe

which is the reference to the application.

There is loads of stuff in this newsgroup on reading the registry and I am
pretty sure the OpenNetCF.org SDF also has registry stuff in there.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top