How do I associate the specified file type with my program?

I have a stand alone program that I want to use as the default opening tool for .jpg and .bmp files. How can I reach the goal progmatically?

Some said that I need to add some registry entries. But I don't know what to do. Can anyone tell me a method?

Thank!

+1


source to share


3 answers


If it's Windows:



CodeProject.com

+1


source


On OS X, update the contents of /Info.plist in the app bundle to preserve the CFBundleDocumentTypes array . Where you specify the extension (CFBundleTypeExtensions), document type name, custom icon, etc.



+1


source


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

[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 need to change programs to open and possibly an icon.

0


source







All Articles