[ZT] customize the program running level in the Vista system

Source: Internet
Author: User
Introduction

This experiment is intended to help you learn how to add your applications to the running level of Vista.

Purpose
  • This experiment allows you to customize the running level of any program.

Procedure 1-ensure that Vista UAC is enabled
  1. First click VistaStartMenu, select Start MenuTopCurrentUser iconAnd click:

  1. SelectTurn User Account Control on or off:

  1. In the dialog box, make sure thatUse User Account Control (UAC) to help protect your computerCheck box is selected:

If this item is not selected, click Select item and then clickOKButton and restart the computer


Step 2- Create a Windows form application
  1. OpenVs 2008, SelectFile->New->Project... :

  1. In the displayed Project Creation wizard, selectVisual C #->Windows->Windows Forms Application:

  1. Enter the project nameVistalogodemoAnd clickOKButton to create a project:

  1. Here, our program is built here. We mainly experience the definition of the Vista running level. Here, click the debug button for debugging:


Procedure 3-add an embedded Custom Level for the program in vs2008 so that the program has the administrator privilege to run
  1. CreateText Files, And name it"Executable File Name. EXE. manifest", Here we write it"Vistalogodemo.exe. manifest", Paste the following content into the file:

 

Code
<? XML version = "1.0" encoding = "UTF-8" standalone = "yes"?>
<Assembly xmlns = "urn: Schemas-Microsoft-com: ASM. V1" manifestversion = "1.0">
<Assemblyidentity version = "1.0.0.0" processorarchitecture = "x86" name = "vistalogodemo" type = "Win32"/>
<Description> description of your application </description>
<! -- Identify the application security requirements. -->
<Trustinfo xmlns = "urn: Schemas-Microsoft-com: ASM. V3">
<Security>
<Requestedprivileges>
<Requestedexecutionlevel level = "requireadministrator" UIAccess = "false"/>
</Requestedprivileges>
</Security>
</Trustinfo>
</Assembly>

There are three running levels here. Here, we use requireadministrator to run with the Administrator permission. If it is written as aslnvoker, it runs with normal permissions.

  1. Store this file to the project's"Bin \ debug"Directory:

  1. Return to the program solution and selectSolution BrowserClick Show All files at the top of the page:

  1. OpenBinDirectoryDebugDirectoryVistalogodemo.exeFile:

  1. After opening the file, the tree list of the EXE file is displayed:

  1. InListUpperRight-clickSelectAdd Resource:

  1. In the displayed dialog box, selectImport:

  1. InFile selection dialog boxSelect all files from the filter box:

  1. Then selectVistalogodemo.exe. manifestFile and clickOpenButton:

  1. This is in the pop-upDialog BoxInResource TypeInputRt_manifest, As shown below, and clickOKButton:

  1. ReturnVistalogodemo.exeFile tree list, find the resource you just addedRt_manifest:

  1. When the value is101NodeRight-clickSelectProperties,Set itsIDAttributeChange1:

  1. Set the value1 [neutral]NodeDelete:

  1. Save the EXE file:

  1. Run the application in the bin \ DEBUG directory of the Project. By default, the program runs as administrator:

-------------------------------------------
Wu Huifeng
Wilson Wu

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.