问题
Time was when you set file associations in:
HEY_CLASSES_ROOT\<.ext>
However, that seems to be possible, but an incomplete solution anymore. There are additional associations throughout the registry. For example:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\KindMap HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\Extensions
And all of the above, but by HKEY_USERS\
And Microsoft added their Set Default Associations control panel applet, which controls... what?
I'm looking for a white paper, or discussions on:
"How is a modern, Windows XP-Windows 7 compatible application written in C/C++ supposed to register and manipulate its file associations without interfering with Explorer, User-Settings, or the Default Associations cpl"
EDIT: I'm trying to further this investigation with more questions here: How to delete ProgIDs from other user accounts when uninstalling from Windows?
回答1:
Alas, this documentation still seems current, and it's all about the registry: MSDN
Maybe someone's created a nice wrapper for this? Time to hit Google...
回答2:
I believe Microsoft wants you to do this through an installation package rather than on-the-fly, since you need elevated permissions to do so.
Edit: See this previous StackOverflow question for how this might be possible.
How to change file association without UAC confirmation?
来源:https://stackoverflow.com/questions/2828637/c-how-do-i-correctly-register-and-unregister-file-type-associations-for-our-a