• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            學無止境

            人生的第10000天

            MFC程序實現xp UI風格二法(2012/10/12)

            參考:
            http://www.cnblogs.com/pkill/archive/2010/07/09/1774527.html
            http://wutiam.net/2009/08/manifest-dependencies-in-visual-studio-2005/

            總結如下:
            1、自動生成XXX.exe.manifest文件
            1)編寫內容。程序使用unicode字符集,stdafx.h 中加入
            #ifdef _UNICODE
            #if defined _M_IX86
            #pragma comment(linker,"/manifestdependency:"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'"")
            #elif defined _M_IA64
            #pragma comment(linker,"/manifestdependency:"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'"")
            #elif defined _M_X64
            #pragma comment(linker,"/manifestdependency:"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'"")
            #else
            #pragma comment(linker,"/manifestdependency:"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'"")
            #endif
            #endif

            若要取消unicode限定,只需修改為:
            #if defined _M_IX86
            #pragma comment(linker,"/manifestdependency:"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'"")
            #elif defined _M_IA64
            #pragma comment(linker,"/manifestdependency:"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'"")
            #elif defined _M_X64
            #pragma comment(linker,"/manifestdependency:"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'"")
            #else
            #pragma comment(linker,"/manifestdependency:"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'"")
            #endif

            注:這些語句也可不寫在stdafx.h中,直接在 “工程屬性頁-》清單工具-》輸入輸出 -》附加清單文件”中添加內容。
            對應X86就添加:
            type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='X86' publicKeyToken='6595b64144ccf1df' language='*'
            不過可能靈活性可能不夠。

            2)然后就是一些設置:
            ☆ 工程屬性頁-》清單工具-》輸入輸出
            嵌入清單:  是
            輸出清單文件:  $(IntDir)$(TargetName)$(TargetExt).embed.manifest 
            清單資源文件: $(IntDir)$(TargetName)$(TargetExt).embed.manifest.res
            ☆ 鏈接-》清單文件-》生成清單文件 設為“是”
            這樣清單文件就會嵌入到exe文件中,單獨執行exe就可以實現xp風格。

            或者,也可以設置“嵌入清單”為“否”
            這樣就會單獨生成個“程序名.exe.manifest"文件,只有與exe文件放在同一目錄下,
            才能實現xp風格。發布時需要同時帶上.manifest文件。

            2、自己創建并引入一個.manifest文件資源

            1) 創建一個.manifest文件的資源.
            在res/文件夾下創建一個跟以程序名加.manifest的文件, 如果程序為test.exe, 則創建test.exe.manifest
            文件內容同上面生成的.manifest文件:
            <?xml version='1.0' encoding='UTF-8' standalone='yes'?>
            <assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
              <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
                <security>
                  <requestedPrivileges>
                    <requestedExecutionLevel level='asInvoker' uiAccess='false' />
                  </requestedPrivileges>
                </security>
              </trustInfo>
              <dependency>
                <dependentAssembly>
                  <assemblyIdentity type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*' />
                </dependentAssembly>
              </dependency>
            </assembly>

            注意要使用utf-8編碼保存。

            2) 將新定義的資源加入到.rc2文件中, 類型設為24.
            打開res/文件夾下的.rc2文件, 在其中加入如下定義:

            1 24 MOVEABLE PURE "res/test.exe.manifest"

            其中的文件地址按1)步中修改的設置即可.注意資源ID值一定要為1,當然可用定義為1的宏表示。

            之后編譯即可, 為了使程序界面可能充分利用系統的界面特性, 可以將界面字體設置為TrueType類型的, 利用Windows XP等系統的屏幕字體平滑特性.







            posted on 2012-10-12 11:06 leafcloudsky 閱讀(594) 評論(0)  編輯 收藏 引用 所屬分類: MFC

            公告

            本博客做為個人工作,生活,學習記錄。多為個人經驗,感想,不保證正確性。請酌情參考。

            導航

            <2025年5月>
            27282930123
            45678910
            11121314151617
            18192021222324
            25262728293031
            1234567

            統計

            常用鏈接

            留言簿

            隨筆分類

            隨筆檔案

            搜索

            最新評論

            閱讀排行榜

            評論排行榜

            久久精品国产色蜜蜜麻豆| 久久精品国产精品亚洲艾草网美妙 | 久久热这里只有精品在线观看| 久久乐国产综合亚洲精品| 久久夜色精品国产www| 久久婷婷五月综合成人D啪| 久久精品国产一区二区三区| 欧美麻豆久久久久久中文| 久久久久久国产精品美女 | 国产高潮国产高潮久久久91 | 91久久精品国产91性色也| 久久这里只精品国产99热| 国产—久久香蕉国产线看观看| 蜜臀久久99精品久久久久久| 久久亚洲精品国产精品婷婷| 亚洲αv久久久噜噜噜噜噜| 久久精品国产亚洲一区二区| 久久综合亚洲色HEZYO国产| 欧美精品国产综合久久| 久久精品国产亚洲精品2020 | 日产久久强奸免费的看| 亚洲欧美日韩中文久久| 97久久超碰国产精品旧版| 久久精品国产精品亚洲人人| 久久毛片一区二区| 久久综合丁香激情久久| 日韩人妻无码一区二区三区久久99| 精品国产乱码久久久久久人妻| 久久精品国产69国产精品亚洲| 久久人人爽人人爽人人片AV东京热| 99蜜桃臀久久久欧美精品网站 | 欧美粉嫩小泬久久久久久久| 久久精品亚洲日本波多野结衣| 国产免费久久久久久无码| 久久久精品久久久久影院| 久久精品国产亚洲AV电影| 久久免费国产精品| 精品久久久久久久| 欧美喷潮久久久XXXXx| 四虎影视久久久免费观看| 久久国产亚洲精品麻豆|