1

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!

user26404
  • 1,371
  • 4
  • 27
  • 38
  • Sounds much like windows, but better clarify which OS you want (Windows, MAC OS, Linux/Unix) – flolo Nov 24 '08 at 08:38

3 Answers3

1

If it's Windows:

CodeProject.com

Igor Semenov
  • 1,548
  • 9
  • 7
  • And here is the source for the class they use: http://www.koders.com/cpp/fidD3DC919BE704A4052DA238D1597A77C1F8FF4D53.aspx –  Nov 24 '08 at 13:35
1

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
  • 17,435
  • 8
  • 50
  • 89
0

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
  • 49,103
  • 10
  • 104
  • 136
  • 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? – user26404 Nov 24 '08 at 09:04
  • You could have a look at the registry, perhaps if there is an entry in HKCR\.jpg already, you have to delete it. – schnaader Nov 24 '08 at 09:09