Click here to Skip to main content
15,888,329 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to set my program to be default viewer for some file type (.pdf) programmatically? Do I need to write some info into registry or to use some windows api (as user can do manually)?

I already (for pdf) set the corresponding registry keys using Inno setup script:

Root: HKCR; Subkey: ".pdf"; ValueType: string; ValueName: ""; ValueData: "myprogramdoc";

Root: HKCR; Subkey: "myprogramdoc"; ValueType: string; ValueName: ""; ValueData: "myprogram PDF Document";

Root: HKCR; Subkey: "myprogramdocument\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\myprogram.exe,1";

and these registries work well for win 7. But under XP, if there is already set some other viewer as default (foxit), my icon will not be presented for pdf (I have to do manually - to choose my program as default viewer).
Posted
Updated 22-May-10 4:24am
v3

1 solution

Yes, it's written in the registry. If you google, it's fully explained in many places.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900