中国IT动力,最新最全的IT技术教程
最新100篇 | 推荐100篇 | 专题100篇 | 排行榜 | 搜索 | 在线API文档 | 网通镜像
首 页 | 程序开发 | 操作系统 | 软件应用 | 图形图象 | 网络应用 | 精文荟萃 | 教育认证 | 硬件维护 | 未整理篇 | 站长教程
ASP JS PHP工程 ASP.NET 网站建设 UML J2EESUN .NET VC VB VFP 网络维护 数据库 DB2 SQL2000 Oracle Mysql
服务器 Win2000 Office C DreamWeaver FireWorks Flash PhotoShop 上网宝典 CorelDraw 协议大全 网络安全 微软认证
硬件维护  CPU  主板  硬盘  内存  显卡  显示器  键盘鼠标  声卡音箱  打印机  机箱电源  BIOS  网卡  C#  Java  Delphi  vs.net2005
  当前位置:> 程序开发 > 编程语言 > ASM汇编
(译)win32asm实例-3
作者:taowen2002 时间:2001-12-09 11:28 出处:互联网 责编:chinaitpower
              摘要:(译)win32asm实例-3

 翻译以得到原作者的授权。在此向他表示感谢!

-译者

3.0 - Resource 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 "\masm32\include\resource.h"

#define        ICON1_BIG           400
#define        ICON2_SMALL         401

ICON1_BIG       ICON    DISCARDABLE     "resources\\big.ico"
ICON2_SMALL     ICON    DISCARDABLE     "resources\\small.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     "resources\\big.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来用

关闭本页
 
首页 | 投资与合作 | 服务条款 | 隐私政策 | 收藏本站 | 设为首页 | 新用户注册 | 免责声明 | 使用帮助
Copyright ©2005-2008 chinaitpower.com All rights reserved. www.chinaitpower.com 版权所有