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

            Welcome to ErranLi's Blog!

              C++博客 :: 首頁 :: 聯(lián)系 :: 聚合  :: 管理
              106 Posts :: 1 Stories :: 97 Comments :: 0 Trackbacks

            常用鏈接

            留言簿(12)

            搜索

            •  

            積分與排名

            • 積分 - 176149
            • 排名 - 151

            最新評論

            閱讀排行榜

            原文:http://dev.csdn.net/article/23/23538.shtm
            作者: ?????

            這應(yīng)該是一個使用VC的一個小技巧,不過在打算做之前,在網(wǎng)上找了找,沒有找到(可能是我填入的關(guān)鍵字不對,:-)),所以在這里給大家提供一個參考,希望對大家能提供方便,不用象我找的這么辛苦。

            意圖:實現(xiàn)多種語言在同一個工程里,如果調(diào)試成功后,即可以同時編譯程序的多種語言版本。

            平臺:Win2000 Pro SP4, VC++6.0,SDK

            一般情況下,編寫程序都會使用工程制作向?qū)В傻墓こ逃袃蓚€編譯版本,一個是Debug,另外一個就是Release,我的目的就是添加多種語言的編譯版本,同時需要多種語言的.rc文件(Source文件),然后經(jīng)過一些簡單的設(shè)置,就Okay了。

            ?????? 我添加很多的圖片,這樣比較容易理解,也少去讀文字的痛苦(用電腦看大篇大篇的文字真的很痛苦)。

            ? 下面我們開始:

            ? 1. 首先是以工程文件里的.rc文件為基礎(chǔ),制作多種語言的.rc文件,就是把有關(guān)對話框,屬性頁,以及一些ID文字替換為其他的語言文字,這里需要注意的 是,不同語言版本的.rc文件,包含很多相同的圖標(Icon),對話框(Dialog),String Table,在VC編譯器的SourceView里都要選擇相應(yīng)的語種。比如:如果是English,以上說的這些都要選擇English(U.S.)。

            ? 2. 添加多語言編譯版本,選擇Build->Configurations,點擊Add,添加相應(yīng)的語言編譯版本,我這里添加的是English Release。隨后添加多種語言版本。

            添加多種語言的編譯版本


            ? 3. 編輯不同語言版本的Project Setting。點擊菜單Project->Settings,修改相應(yīng)的設(shè)置
            設(shè)置Output directories: 包括Intermediate和Output files,我這里都設(shè)置為English Release
            設(shè)置Output file name: 我這里設(shè)置為English_Release/ktrexe.exe

            設(shè)置
            Language英語(美國)?????

            ?

            4. 添加Source Files

            ?

            添加后會彈出一個對話框,不用理會它

            此時你可以在你編譯器的ResourceView里看到:

            ?

            以后如果需要修改不同的語言,可以修改相應(yīng)的resources文件。


            5. 點擊Project->Settings,點擊你所點擊的.rc文件

            ?

            選中Exclude file from build

            ?

            選擇“是”,每一種.rc文件分別選取相應(yīng)的語言編譯版本,比如Win32 English Release,選擇Winapp1_English.rc,然后在Exclude file from build打勾即可。

            ?

            6. 編譯:

            選擇Build->Batch Build

            ?

            選中您所要編譯的語種,選中Selection only,點擊Rebuild All即可。

            ?

            7. 此時,您可以看到您的.dsp文件已經(jīng)被修改。

            ?

            ?????? 我曾經(jīng)在CSDN論壇上問過此問題,還有不同的解法,我把他們帖出來:

            ?

            ??? 我的操作是在VC++6.0里有一個用Win32程序向?qū)傻囊粋€工程,此工程代碼添加,調(diào)試,運行都已經(jīng)Okay

            ??? 由于該工程是簡體中文的,我想添加其他的語言版本,我就在.rc復本的基礎(chǔ)上把簡體中文的項目換成了其他的語言(比如西班牙語),然后我在Build->Configurations里添加了Spanish Release,在Project-Settings里設(shè)置了語言環(huán)境,輸入路徑等等屬性。隨后我就在Project-Add Files添加我剛才更換語言的.rc文件添加進來。

            ??? 目的是用Debug調(diào)試,然后在Build-Batch Build選項里選擇我要編譯的語言種類,一次編譯多種語言。

            ??? 問題是VC6.0提示說“Multiple.rc files exist in this project. Only one can be marked as included in the build. The others will be excluded frome the build.

            ??? 請問,如何解決這個問題,我在網(wǎng)上找了兩天了,在其他的Newsgroups上法帖,沒有找到答案,是不是我哪里設(shè)置錯了,請高手給個提示。謝謝!

            ?

            把你現(xiàn)在的.rc保存,然后把所有的中文換成其他語言,別存為其他other.rc

            GetResourceInstance()得到資源句柄。換成另other.rc,(SetResourceHandle)

            就可以搞定。

            因為所有的id沒變,所有程序都能正常運行。

            最好把資源做成dll,LoadResource切換

            寫成INI也是一個好辦法!

            ?

            其他論壇的回答:

            Several solutions:
            1. Place all your resources into one big. rc file.
            2. Exclude the additional rc files from the build and include them by the
            resource includes (right mouse click on the resource file in the resource
            editor). In this case you have to take care that bitmaps and others are only
            included once!
            3. Create seperate DLL's for each language and use the corresponding handle
            to this DLL when loading resources. Read the docu to AfxSetResourceHandle
            when you are using the MFC.

            1)????? use the "resource includes" menu item in VC C++ 6.0 and include one
            resource in the other (i.e. #include "file.rc")? Make sure that there are no
            conflicts and each resource is properly marked with the correct language.
            Mark the RC file as excluded from the build.? It will get built anyway since
            it was included in the main RC.

            2)????? have separate DLL (i.e. a separate sub-project) for each RC file (the
            satellite DLL approach to localization)

            If you are unhappy with having separate builds for each language then
            you'll have to combine the .rc files with (or without if they doesn't use
            same identifiers) the proper LANGUAGE ID #ifdef's. If you don't know
            about these, use the Resource editor built into the Environment to create
            a new .rc with element variants in several languages. Then open the file
            and analyse it.

            In VS.NET 2003 click on Build>Configuration Manager
            You will find your project. Now it is possible to select New in the combo
            "Active Solution Configuration" you can add new settings to the current ones
            Debug/Release.
            In VS6 click on Build->Configurations. You will find your project displayed
            as a tree. Click on Add to add new configurations.
            In both caes you will be asked what base configuratin should be copied.

            Now you can create different Release modes like German/English/Bavarian and
            so on...
            For each configuration you can define diffrent rc files to be excluded from
            the build. Also you can define different output directories.

            The disadvantage is that you always have a complete binary for a language
            and you can not switch the language on user request!

            ?

            ?

            如果有問題,請和我聯(lián)系:danielxu22@cellink.com.cn

            posted on 2007-10-13 21:24 erran 閱讀(1166) 評論(1)  編輯 收藏 引用 所屬分類: MFC

            Feedback

            # re: 轉(zhuǎn):如何在同一個工程里添加多種語言 2009-03-07 09:10 岳陽
            思路明白了。哈哈  回復  更多評論
              

            一本久道久久综合狠狠爱| 国内精品久久久久伊人av| 无码人妻精品一区二区三区久久久 | 无码精品久久久天天影视| 欧美成人免费观看久久| 中文字幕乱码人妻无码久久| 精品久久久噜噜噜久久久| 精品无码久久久久久国产| 婷婷久久五月天| 人妻无码久久一区二区三区免费 | 日批日出水久久亚洲精品tv| 无码AV波多野结衣久久| 99久久伊人精品综合观看| 久久人人爽人人爽人人片AV不 | 亚洲精品WWW久久久久久| 免费观看久久精彩视频| 97精品伊人久久久大香线蕉| 久久久久中文字幕| 国产精品美女久久福利网站| 免费精品久久久久久中文字幕| 国产99久久久久久免费看| 欧美激情一区二区久久久| A级毛片无码久久精品免费| 无码人妻精品一区二区三区久久| 久久精品国产精品亚洲| 久久影视综合亚洲| 国产精品美女久久久久网| 国内精品九九久久久精品| 一本久久综合亚洲鲁鲁五月天亚洲欧美一区二区 | 伊人久久免费视频| 久久久久九九精品影院| 国产精品九九九久久九九| 亚洲女久久久噜噜噜熟女| 久久久久久国产精品美女| 久久精品国产亚洲AV影院| 久久久精品视频免费观看| 国产精品日韩欧美久久综合| 国产精品美女久久久免费| 国产2021久久精品| 久久99精品九九九久久婷婷| 久久99精品国产麻豆不卡|