I want to set up my application to have a file association in Windows (additional complication: the file extension could conflict with some other unrelated application). What is the best way to handle a situation like that? Most likely, a user wouldn't have both, but in the event that they do, what is the best way to proceed?
I've been searching stackoverflow and various other sites online, and have a basic idea of how to do this (I've tried it, and it works), but can not find a definitive reference on how this is best done.
Some references say put entries into the registry in HKEY_CLASSES_ROOT. Some say don't do that, and instead put it into HKEY_LOCAL_MACHINE\Software\Classes.
Does the application also need to be registered under HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths or HKEY_CLASSES_ROOT\Applications (and is this even the technically correct location with reference to the discussion about HKEY_CLASSES_ROOT vs HKEY_LOCAL_MACHINE\Software\Classes above)?
I've also seen some pages advise about setting "CurVer" and "OpenWithProgids", but I'm not sure how they would help.
I found that I can just create
HKEY_LOCAL_MACHINE\Software\Classes.aaa (Default) AAAapp
HKEY_LOCAL_MACHINE\Software\Classes\AAAapp (Default) AAAapp DefaultIcon "%mypath%\to\AAAappIcon.ico" shell\open\command "%mypath%\to\AAAapp.exe" "%1"
and it works. I didn't create the App Paths or Applications registry key, so those keys do not appear to affect this. As well, the above appears to have no provision for nicely handling the case where an association for an ".aaa" file extension already exists on the system.
Any guidance is appreciated!