(譯)win32asm例項-3 (轉)
翻譯以得到原作者的授權。在此向他表示感謝!
-譯者
3.0 - Re file資源
We will only add some icons to our resource file for now, and change it later.
現在我們僅僅新增一些圖示到我們的資原始檔中,再後面還要改變它。
Create a new empty text file called mosaic.rc in your mosaic folder. Put the following text in the file:
在你的mosaic檔案加中建立一個名為mosaic.rc的空白文字檔案。把一下文字輸入檔案:
#include "masm32includeresource.h"
#define ICON1_BIG 400
#define ICON2_SMALL 401
ICON1_BIG ICON DISCARDABLE "resourcesbig.ico"
ICON2_SMALL ICON DISCARDABLE "resourcessmall.ico"
If you have a resource editor and you know how to use it, you can make the resource file with an editor, but I will show you how to do it by hand, so everyone can create a resource file, even without a resource editor.
如果你有一個資源編輯器而且你知道如何使用它。你可以用編輯器建立資原始檔,但我會向你展示如何用手工的方法完成它。因此每個人都可以建立資原始檔,即使沒有資源編輯器。
The #include statement includes a file called resourece.h from the masm32 package. This file is included in the masm package so you can use some constants in your resource definitions (like dialog styles etc.). The #defines associate a resource name (ICON1_BIG) with an ID (400 decimal). After you've defined a name, you can define the resource:
#include語句從masm包中包含了一個名為resource.h的檔案。這個檔案在masm包中因而使得你可以在資源定義中使用一些常熟(比如對話方塊的樣式等)。#define把資源名(ICON1_BIG)和ID(十進位制400)關聯起來。在你定義了名字後,你可以定義資源:
ICON1_BIG ICON DISCARDABLE "resourcesbig.ico"
This line adds an icon to the resource file (note the double backslash in the filename, always do this, a single backslash is an escape character). The resource is read from the file big.ico in the resources folder. For the small icon it works the same.
這行程式碼把一個圖示加入資原始檔(注意檔名中的兩個反斜槓,每次都要這麼作,單個的反斜槓試跳脫字元)。資源從資原始檔夾中的big.ico中讀取。對於小圖示也是一樣。
3.1 - Resource IDs資源ID
In order to use the resources, you will have to know their IDs. We will define IDs in the include file mosaic.inc. Add the two IDs for the icons to your mosaic.inc file:
為了使用資源,你要知道它們的ID。我們將在包含檔案mosaic.inc中定義ID。把這兩個圖示的ID加入你的mosaic.inc檔案:
ICON1_BIG equ 400
ICON2_SMALL equ 401
Now you can use ICON_BIG and ICON_SMALL in your programs as an ID.
西拿在你可以在你的中把ICON_BIG 和 ICON_SMALL當作ID來用。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10752043/viewspace-991737/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- (譯)win32asm例項-1 (轉)Win32ASM
- (譯)win32asm教程-7 (轉)Win32ASM
- (譯)win32asm教程-9 (轉)Win32ASM
- (譯)win32asm教程-8 (轉)Win32ASM
- (譯)win32asm教程-10 (轉)Win32ASM
- (譯)win32asm教程-11 (轉)Win32ASM
- (譯)win32asm教程-5 (轉)Win32ASM
- (譯)win32asm教程-6 (轉)Win32ASM
- (譯)win32asm教程-12-完結 (轉)Win32ASM
- 3D旋轉效果程式碼例項3D
- CSS3旋轉效果程式碼例項CSSS3
- win32asm原理 (轉)Win32ASM
- javascript元素3D旋轉效果程式碼例項JavaScript3D
- CSS3實現的3D旋轉程式碼例項CSSS33D
- APIHOOK例項剖析 (轉)APIHook
- [譯]使用JavaScript建立WebAssembly模組例項JavaScriptWeb
- 演示中斷處理的例項(例項六)(轉)
- Win32 SDK封閉例項——普通的Windows程式(翻譯) (轉)Win32Windows
- 3.activiti7 流程例項
- oracle單例項轉RACOracle單例
- (轉)MySQL優化例項MySql優化
- 網站綜合例項(轉)網站
- [轉]BDB例項程式碼
- 網站綜合例項 (轉)網站
- AsmL例項研究(二) (轉)ASM
- css3實現的旋轉魔方效果程式碼例項CSSS3
- Win32ASM經驗點滴 (轉)Win32ASM
- [譯]在JavaScript中建立WebAssembly模組例項JavaScriptWeb
- 如何將獨立例項轉換成叢集例項EU
- CSS3雪人程式碼例項CSSS3
- (轉)Python例項手冊Python
- CSS3 旋轉太極八卦圖程式碼例項CSSS3
- css3 車輪轉動的自行車效果程式碼例項CSSS3
- [非專業翻譯] Mapster - 配置例項
- css3實現旋轉的太極圖效果程式碼例項CSSS3
- CSS3卡通形象程式碼例項CSSS3
- css3 animation動畫程式碼例項CSSS3動畫
- css3星空效果程式碼例項CSSS3