views:

184

answers:

3

I have a self-developed program which I want to use as the default opening tool for .jpg and .bmp files. How can I achieve the goal progrmmatically?

Some said that I have to add some registry entries. But I don't konw exactly what I should do. Can anyone tell me the method?

Thank you!

+1  A: 

If it's Windows:

CodeProject.com

Igor Semenov
And here is the source for the class they use:http://www.koders.com/cpp/fidD3DC919BE704A4052DA238D1597A77C1F8FF4D53.aspx
Arkadiy
A: 

You have to change these registry entries (for Windows, .REG syntax):

[HKEY_CLASSES_ROOT\.txt]
@="textfile"

[HKEY_CLASSES_ROOT\textfile\shell\open\command]
@="C:\\WINDOWS\\NOTEPAD.EXE %1"

[HKEY_CLASSES_ROOT\textfile\shell\print\command]
@="C:\\WINDOWS\\NOTEPAD.EXE /p %1"

[HKEY_CLASSES_ROOT\textfile\DefaultIcon]
@="C:\\WINDOWS\\SYSTEM\\shell32.dll,-152"

Of course, you have to change the programs to open and perhaps the icon.

schnaader
I have done so, but it doesn't work. I think maybe it is because that my .jpg files have been registered to other applications such as ACDSee. What shall I do to change this?
You could have a look at the registry, perhaps if there is an entry in HKCR\.jpg already, you have to delete it.
schnaader
+1  A: 

On OS X, update the Contents/Info.plist in the app package to hold a CFBundleDocumentTypes array. In which you specify the extension (CFBundleTypeExtensions), name of document type, custom icon etc.

Pieter