【轉】mfc win7獲得管理員權限 使用WIN7風格 使用當前系統風格

來源:互聯網
上載者:User

標籤:

原帖:http://blog.csdn.net/zengweicdut/article/details/8837688

在win7下,作業系統檔案夾下的東西,需要程式擁有管理員權限才可以,程式擁有管理員權限的方法為:

一、添加管理員權限

1、在Resource View中添加一個檔案夾,名稱為24,將檔案夾下的資源名稱改為1.操作

(1)

(2)

(3)

2、在資源1中添加下面的值,將下面的文字複製,粘貼進去就可以:

<?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> 

粘貼後

然後,編譯,軟體就是擁有管理員權限的程式了。程式表徵圖上,也會多一個盾,在XP下沒有差異。

二、讓應用程式使用當前系統的風格:

1、也是在ResourceView中添加一個24,1的資源,和添加管理員一樣。

2、將1中的值設定為:

<?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>

這樣,程式就擁有了當前系統風格,比如win7的風格,就是加了當前風格的一個例子,按鈕已經是win7風格了。

 

注意:程式只能擁有一個24,1的資源,而且資源下名字必須為24和1,也就導致,程式擁有管理員權限,就不能擁有系統風格,2者只能選1來使用,這一點是比較鬱悶的。

 

【轉】mfc win7獲得管理員權限 使用WIN7風格 使用當前系統風格

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.