"Go" MFC Win7 Get Administrator privileges use the current system style using WIN7 style

Source: Internet
Author: User

Original posts: http://blog.csdn.net/zengweicdut/article/details/8837688

Under the Win7, under the operating system folder, you need the program to have administrator rights, the program has administrator rights to the method:

One, add administrator rights

1, add a folder in Resource view, name 24, change the resource name under folder to 1. Operation

(1)

(2)

(3)

2, add the following value in the resource 1, copy the following text, paste in it can:

<?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= "Mulitray.exe.manifest"
Type= "Win32"
/>
< TrustInfo xmlns= "Urn:schemas-microsoft-com:asm.v3" >
<security>
<requestedPrivileges>
<requestedexecutionlevel level= "Requireadministrator" uiaccess= "false"/>
</requestedPrivileges>
</security>
</trustinfo>
</assembly>

After pasting

Then, compiling, the software is a program with administrator privileges. program icon, there will be one more shield, there is no difference under XP.

Second, let the application use the current system style:

1, also add a 24,1 resource in ResourceView, and add the same as the administrator.

2. Set the value in 1 to:

<?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= "Microsoft.Windows.DundasDemo"
Type= "Win32"
/>
< Description>your app Description here</description>
< dependency>
<dependentAssembly>
<assemblyidentity
Type= "Win32"
Name= "Microsoft.windows.common-controls"
version= "6.0.0.0"
Processorarchitecture= "X86"
Publickeytoken= "6595B64144CCF1DF"
Language= "*"
/>
</dependentAssembly>
</dependency>
</assembly>

In this way, the program has the current system style, such as Win7 style, is added to the current style of an example, the button is already win7 style.

Note: The program can only have a 24,1 resources, and the resources under the name must be 24 and 1, it is also caused, the program has administrator rights, you can not have the system style, 2 can only choose one use, this is more depressed.

"Go" MFC Win7 Get Administrator privileges use the current system style using WIN7 style

Related Article

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.