The UAC window pops up when the program runs by embedding manifest into the program

Source: Internet
Author: User

We know that when a program requires permission to run, you need to right-click the program and then open the program with administrator privileges. In addition, if you use vc2008 above the development program, you can choose UAC in the project, in the generated program, if you click the Run program will pop up the window that requires administrator privileges to run the program.

It is now possible to achieve this effect by embedding the manifest in a common program.

Now, let's talk about it. Add this feature to a program that does not pop up requiring administrator privileges when you click Run.

1, if the ordinary program name is Myapp.exe.

Now write a manifest file in the program directory named Myapp.exe.manifest.

The manifest file is as follows:

[HTML]View Plaincopyprint?
  1. <? XML version= "1.0" encoding="UTF-8" standalone="yes"?>
  2. <Assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestversion="1.0">
  3. <assemblyidentity
  4. version="1.0.0.0"
  5. processorarchitecture="X86"
  6. name="Myapp.exe.manifest"
  7. type="Win32"
  8. />
  9. <trustinfo xmlns="Urn:schemas-microsoft-com:asm.v3">
  10. <security>
  11. <requestedprivileges>
  12. <requestedexecutionlevel level="requireadministrator" uiaccess="false"/>
  13. </requestedprivileges>
  14. </Security>
  15. </trustinfo>
  16. </Assembly>


2, now you click Run myapp.exe program, you will need to have administrator privileges to run the window.

3, but we can not need this manifest file, because we can put this menifest file embedded in the program, so in the program directory does not need this file.

In the Windows system disk directory C:\Program Files\Microsoft Sdks\windows\v7.0a\bin a program is Mt.exe.

Run this command under the console: Mt.exe-manifest h:\myapp.exe.manifest-outputresource:h:\myapp.exe;1

Then we can delete this myapp.exe.manifest file.

Now click on your program, will not pop up a window that requires Administrator privileges AH:)

http://blog.csdn.net/fjb2080/article/details/7261861

The UAC window pops up when the program runs by embedding manifest into the program

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.