Click here to Skip to main content
15,884,473 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have created a VC++ project in VS2008 (VISTA) using the MFC wizard. The InitInstance() function includes the statement RegisterShellFileTypes(TRUE). The application runs, reads and writes data files correctly. However,

1) When it writes a file, the icon associated with the file is the VS icon and not the application icon!
2) When I double-click on the icon, a strange binary-type file opens up on the screen instead of the application!

I have also noticed that on DEBUG runs, the warning " registration database update failed for key 'XXX.Document' " where XXX is the name of the application.

Is there an MFC bug or am I doing something wrong??
[no name] 19-Aug-13 14:19pm    
"Is there an MFC bug or am I doing something wrong?", most likely, you have done something wrong.

1 solution

Doing something wrong.

Probably, what is happening is that your application does not have sufficient privileges to edit the registry, which is why you get the "update fail" message - and if it can't edit the registry, it can't change the file association.

You probably want to set the association once as part of an installation process anyway.
Certainly, programs which reset my associations without both asking and remembering that they have asked allready do not last long on my computer!
Share this answer

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

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