This problem I am having is very easy to reproduce. Create a basic MFC MDI application with file extension as .xyz using Visual Studio 2010. The application default code readily registers the file associations via calls:
// Enable DDE Execute open
EnableShellOpen();
RegisterShellFileTypes(TRUE);
The problem is that inside RegisterShellFileTypes(TRUE), the call below fails:
if (!_AfxSetRegKey(strFileTypeId, strFileTypeName))
continue; // just skip it
The file is obviously not being registered and it doesn’t adopt the application assigned file icon. All I want is when I double click the registered file type (in this case .xyz) it should open in the application but it doesn’t. What is possibly missing..how to make this work?
Microsoft has changed their concept of registering an extension over the years. Starting with Vista, it’s expected that the extension will be registered at installation time with a Setup application which will have Admin privileges. The registry keys necessary to map an extension to an application are now in a protected area of the registry. What you’re asking for is no longer possible.