• <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++博客 :: 首頁 :: 聯系 :: 聚合  :: 管理
              106 Posts :: 1 Stories :: 97 Comments :: 0 Trackbacks

            常用鏈接

            留言簿(12)

            搜索

            •  

            積分與排名

            • 積分 - 174947
            • 排名 - 151

            最新評論

            閱讀排行榜

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

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

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

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

            一般情況下,編寫程序都會使用工程制作向導,生成的工程有兩個編譯版本,一個是Debug,另外一個就是Release,我的目的就是添加多種語言的編譯版本,同時需要多種語言的.rc文件(Source文件),然后經過一些簡單的設置,就Okay了。

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

            ? 下面我們開始:

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

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

            添加多種語言的編譯版本


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

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

            ?

            4. 添加Source Files

            ?

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

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

            ?

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


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

            ?

            選中Exclude file from build

            ?

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

            ?

            6. 編譯:

            選擇Build->Batch Build

            ?

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

            ?

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

            ?

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

            ?

            ??? 我的操作是在VC++6.0里有一個用Win32程序向導生成的一個工程,此工程代碼添加,調試,運行都已經Okay

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

            ??? 目的是用Debug調試,然后在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.

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

            ?

            把你現在的.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!

            ?

            ?

            如果有問題,請和我聯系:danielxu22@cellink.com.cn

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

            Feedback

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

            久久亚洲精品中文字幕三区| 久久国产精品偷99| 一本综合久久国产二区| 精品久久久久久无码人妻蜜桃| 99麻豆久久久国产精品免费 | 久久精品中文无码资源站| 亚洲伊人久久综合影院| 一本色道久久综合亚洲精品| 777米奇久久最新地址| 亚洲国产精品久久电影欧美| 精品国产青草久久久久福利| 精品伊人久久久| 久久这里只有精品首页| 色欲综合久久中文字幕网| 99久久99久久精品国产片果冻| 久久精品国产久精国产果冻传媒 | 久久精品国产亚洲5555| 久久99精品久久久久久齐齐| 久久精品国产亚洲精品| 日本高清无卡码一区二区久久| 亚洲人成无码久久电影网站| 久久狠狠爱亚洲综合影院| 影音先锋女人AV鲁色资源网久久| A级毛片无码久久精品免费| 囯产极品美女高潮无套久久久| 麻豆AV一区二区三区久久| 久久精品成人免费看| 精品久久国产一区二区三区香蕉| 一本大道久久东京热无码AV| 午夜久久久久久禁播电影| 国产美女久久精品香蕉69| 成人精品一区二区久久久| 欧美亚洲日本久久精品| 人妻精品久久久久中文字幕一冢本| 国产亚洲欧美精品久久久| 国产精品99久久精品爆乳| 久久这里都是精品| av午夜福利一片免费看久久| 久久精品一区二区影院| 久久精品蜜芽亚洲国产AV| 一级做a爰片久久毛片人呢|