9.21. Run a Windows Vista Application with Elevated Rights

Problem

Your Vista application requires administrator rights to execute.

Solution

Create an application manifest with the requestedExecutionLevel element set to requireAdministrator, and then embed the manifest into your application.

NOTE

Using the manifest solution is supported only in Windows Vista because it pertains to its User Account Control (UAC) feature. If you are not using Vista, the manifest will be ignored, and you will want to use impersonation to force your application to run under a different user's account.

How It Works

Windows Vista institutes a new security model, in which everything is executed under the rights of a normal user, even if launched by an administrator. ...

Get Visual Basic 2008 Recipes: A Problem-Solution Approach now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.