I have an application that writes program settings to the windows registry that is absolutely necessary so.storing to a file is not an option.
To simplify this, I wo
I already commented that "Writing program settings to the registry is not a proper cause to give your application admin privileges". However it is a good idea to include a UAC manifest in any case. the common requestedExecutionLevel
should be level="asInvoker"
. see the docs
"Q: Adding manifest for admin rights request for delphi 7"
Create the below 4 files (2 sets):
(UAC Only)
uac.manifest
uac.rc
1 24 "uac.manifest"
(UAC + XP Themes)
uac_xp.manifest
uac_xp.rc
1 24 "uac_xp.manifest"
Add the desired rc
file (uac.rc
or uac_xp.rc
) to your project via the "Project > Add to project" menu item. This will create the {$R}
directive in your project file:
program Project1;
{.$R 'uac.res' 'uac.rc'} // UAC only
// OR
{$R 'uac_xp.res' 'uac_xp.rc'} // UAC + XP Themes
uses
Forms,
Unit1 in 'Unit1.pas' {Form1};
{$R *.RES}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
Note the {$R 'uac_xp.res' 'uac_xp.rc'}
. Delphi will auto compile the rc
to res
file.
Alternatively you can compile the rc
file via brcc32 uac.rc
outside Delphi IDE. and then add {$R 'uac_xp.res'}
manually to your project.
Make sure you don't use any other XP manifest.