Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 834511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:40:57+00:00 2026-05-15T04:40:57+00:00

So far if I had to associate the file extension with my application I

  • 0

So far if I had to associate the file extension with my application I used to simply modify the registry. However I haven’t been doing it for years, and I’m afraid the things might have changed a bit. I have no idea how to prevent registry access restrictions in Windows 7 / Vista (if there are any for HKEY_CLASSES_ROOT). Thus I’m looking for some delphi library, unit, code snippet or whatever which works reliably under XP, Vista and 7.
Is there any which handles “backup” as well? By backup I mean possibility to revert the changes to the previous association…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T04:40:58+00:00Added an answer on May 15, 2026 at 4:40 am

    I would recommend against using a 3rd-party component for this, for it will only make things more complicated.

    We all know how to make file associations by editing the HKEY_CURRENT_USER and HKEY_LOCAL_MACHINE hives, right? In Windows Vista+, editing the former implies no trouble, but if you for some reason want to edit the latter, i.e. if you want to edit the associations for all users on the machine, then your app needs to run with elevated privileges.

    To make an application run with elevated privileges, the user can right-click the icon and select “Run as administrator”. But that is ugly. One can, however, make an application run as administrator automatically, simply by adding a manifest (an XML file) to the application’s resource. Then the UAC prompt will popup automatically upon execution of the *.exe file, no matter how the end user starts the program, and the program will be run as an administrator, and is perfectly able to alter the HKEY_LOCAL_MACHINE hive. The details on how to add this manifest has been explain in several SO questions. It really is easy.

    As far as I know, it is not possible for a running application to “upgrade” its privileges at runtime. So if you have a button in your app, running with normal privileges, you cannot do something like this:

    procedure Button1.Click(Sender: TObject);
    begin
      SomehowGetAdminPrivileges;
      ChangeLocalMachineRegistry;
      SomehowGetBackNormalPrivileges;
    end;
    

    That is simply not possible. So if you need to do something that requires admin privileges during runtime, you need to call an external application, as in

    procedure Button1.Click(Sender: TObject);
    begin
      ShellExecute(Application.Handle, nil, PChar('myapp.exe'), nil, nil, SW_SHOWNORMAL);
    end;
    

    myapp.exe needs to have a manifest, so that it will run with raised privileges, and is able to do what you want. But preferably myapp.exe should not have a GUI – when the user clicks the button, the UAC prompt appears, and the the myapp.exe performs the registry change and then terminates.

    It would be possible but awkward to accomplish this using a 3rd-party component.

    Do you need to change the registry during setup? If you use Inno Setup, the professional and free tool, Inno Setup will include the manifest for you. Hence the UAC prompt will appear when starting setup.exe (compiled with Inno Setup) if the setup requires it, e.g. if the setup will make any changes to HKEY_LOCAL_MACHINE.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.