Re: File Association in Dialog-Based Application
"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message
news:kkucg4d9n2j4qu1lke6cqr8dgm2h68a0qv@4ax.com...
No, go read the code. It is in docmgr.cpp. While the particular
subroutine shown is a
class method of CDocManager, the code shows you what needs to be done (one
of the
advantages of visible source). So you *can* take the code from the
source that does the
registration.
Well, the way "regular" apps do it is by calling RegisterShellFileTypes().
As the docs state, before calling this method, I must call AddDocTemplate(),
which requires a reference to a CDocument class.
But, yes, I can study the MFC code to see how it is accomplished. I'm a bit
surprised to hear it's in CDocManager since the method for this
(RegisterShellFiletypes) is in CWinApp.
But I'll take your advice and find it in the code and see what's involved.
Generally, file associations are done in HKEY_CLASSES, which is normally
protected. This
is a major design failure in file associations; there SHOULD be a way for
any given
logged-in user to have USER-SPECIFIC file bindings. Fortunately, Vista
handles this by
virtualizing the Registry (a feature which is said to be potentially
unsupported in future
releases), but the real problem was the failure to think about per-user
bindings.
Yeah, there seems to be a mess of PITA issues in the name of security. Tom's
suggestion of doing it in the Setup program makes a lot of sense.
Thanks.
--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com