Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2007 Mar : How to create file association programmatically in Vista?

www.cryer.info
Managed Newsgroup Archive

How to create file association programmatically in Vista?

Subject:How to create file association programmatically in Vista?
Posted by:"mark horridge" (mark.horrid..@buseco.monash.edu.au)
Date:Fri, 16 Mar 2007 00:07:28

My program, running fine on WinXP, registered its own file extension
(if user agreed) using some code based on this fine Peter Below example:
***************************************************
Procedure InternalRegisterFiletype( Const extension, filetype,
description,
             verb, serverapp: String );
  Var
    reg: TRegistry;
    keystring: String;
  Begin
    reg:= TRegistry.Create;
    Try
      reg.Rootkey := HKEY_CLASSES_ROOT;
      CreateKey( reg, extension );
      reg.WriteString( '', filetype );
      reg.CloseKey;
      CreateKey( reg, filetype );
      reg.WriteString('', description );
      reg.closekey;
      keystring := Format('%s\shell\%s\command', [filetype, verb] );
      CreateKey( reg, keystring );
      reg.WriteString( '', serverapp);
      reg.CloseKey;
    Finally
      reg.free;
    End;
  End; { InternalRegisterFiletype }
****************************************
Now, under Vista, the above does not work for a "limited user". I know why,
but I do not know in detail how to fix it, or if I can. Of course, a
solution that also worked under XP
would be nice.


Dr. J. Mark Horridge, Centre of Policy Studies,
Monash University, AUSTRALIA
mark.horridge@buseco.monash.edu.au
www.monash.edu.au/policy/jmh.htm

Replies:

www.cryer.info
Managed Newsgroup Archive