How to force a Win app to start with admin privileges ?

Hello,

I’m using the RegistryItem class to write into the Windows registry database. This requires the software being started with administrator privileges, which could be done by using the app’s context menu or adjusting compatibility settings. But both ways are not very intuitive for the average user.

Is there a way to “force” (or ask nicely :wink: a Windows app starting with admin privileges programmatically ?

Thank you,
Tobias.

Hi,

You may find the answer here:

https://forum.xojo.com/4430-windows-local-machine-registry-and-admin/0#p30858

https://forum.xojo.com/2933-shell-command-in-adminstrator-mode

http://www.xojo.com/blog/en/2013/08/running-xojo-apps-on-windows-with-elevated-uac.php

Pixe

Thank you. I’ll try calling a little helper app from App.Open that way.

You can use a PE editor (e.g. ResEdit, which is free) to modify your built app’s manifest. In the manifest, you can specify the UAC execution level required:

See the remarks on this page to learn about the different execution levels and what they mean. For example, if your app should only be run by administrators but never by normal users, the requireAdministrator is the proper execution level.

Thank you, Andrew. I’ll also look at this solution.