- 热门文章:
- · 关于在COM中使用可选参数的研究
- · delphi中使用Report Machine解决中式带边条及固定行的疑难报表(上)
- · delphi技巧——移动无标题窗口
- · Shell_NotifyIcon函数新特性---Balloon Tips之深入研究
- · 2002-05-27 Borland 预览基于Symbian操作系统用于开发2.5G/3G移动应用的C++技术
- · Delphi.NET previewed at SD West
- · 由shape控件得到Rgn(2000/11/21 三金 版权所有
- · 用Delphi“遥控”按钮
- · 《Delphi高手突破》初稿目录
- · 《Delphi高手突破》第0章(预览版)——关于本书
- · Delphi版OpenGL样例代码导游
- · EXE工程和OCX工程的转化(2002/5/30 三金 版权所有)
在Delphi中如何使用RC文件中的字符串表
在Delphi中如何使用RC文件中的字符串表
原作作者:wangzhidong(Steven Bob)
时间:2002年3月25日星期一
首先用Notepad或Resource workshop 4.5建立RC文件。
结构如下
|
/**************************************************************************** rcdemo.rc produced by Borland Resource Workshop *****************************************************************************/ #include "urcdemo.pas" STRINGTABLE { IDS_HELLO, "I am glad to see you." IDS_RC, "This programming is created by %s." } |
然后用BRCC.EXE 或BRCC32.exe把rcdemo.rc编译成rcdemo.res文件,接着把rcdemo.res改名
为rcdemo.rc文件。 如用Resource workshop 4.5会产生一个PAS单元文件,本例为urcdemo.pas
内容如下:
|
(**************************************************************************** urcdemo.pas produced by Borland Resource Workshop *****************************************************************************) unit urcdemo; interface const IDS_HELLO = 2; IDS_RC = 1; implementation end. |
利用此项技术可实现错误处理中字符串问题存储问题和程序的本地化问题。
范例:
|
unit ufmRCDemo; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) GroupBox1: TGroupBox; Button1: TButton; Button2: TButton; GroupBox2: TGroupBox; Button3: TButton; Button4: TButton; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button3Click(Sender: TObject); procedure Button4Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation uses urcdemo; {$R rcdemo.rc} {$R *.dfm} {利用windows API} procedure TForm1.Button1Click(Sender: TObject); var arystr: array [0..255] of char; begin windows.LoadString(hInstance, IDS_RC, arystr, sizeof(arystr)); ShowMessage(arystr); end; procedure TForm1.Button2Click(Sender: TObject); var arystr: array [0..255] of char; begin windows.LoadString(hInstance, IDS_Hello, arystr, sizeof(arystr)); ShowMessage(arystr); end; {利用Delphi原生函数} procedure TForm1.Button3Click(Sender: TObject); begin ShowMessage(LoadStr(IDS_Hello)); end; procedure TForm1.Button4Click(Sender: TObject); begin ShowMessage(LoadStr(IDS_RC)); end; end. |
注意:16位格式于32位格式的差异。
实例下载:
- · 如何实现API钩子
- · 界面(FORM)自动生成工具
- · etcell报表组件完美的解决了Delphi中有关报表的问题,包括数据库的报表!
- · OCX中得到IE传递的参数(2002/5/30 三金 版权所有)
- · DLL 應用 - 設計可抽換的模組
- · 讀取 Access 資料庫的圖形欄位
- · Delphi 元件設計初步(一)
- · Web Services 學習筆記(一)
- · 使用Delphi 發展商業物件
- · Adapter 樣式
- · delphi中的时间操作技术(1)
- · delphi中的时间操作技术(2)
- · 用Delphi编写涂鸦桌面的小程序
- · Why Pascal is Not My Favourite Programming Language
- · 数据库的一种完全面向对象设计模式(包含实例) Rayphrank原创!
- · 如何在 Listbox 上显示 In-place Tooltips
- · 在Delphi中捕获控制台程序的输出
- · Shell编程---如何判断一目录是否共享?
- · 使用Windows消息控制Winamp(Delphi)
- · 关于读写注册表二进制数据的问题
- · 轻松实现DBGrid的多表头
- · 启动外部程序并等待它结束
- · 如何取得系统中的桌面的路径
- · 如何统一Win98与WinXP(Win2000)操作系统下的字体大小
- · 如何用Tprinter设计BCB操作数据库程序中的报表
- · 用BCB编写一个改写oracle日期显示格式的程序
- · 利用剪贴板实现高速导出数据到Excel
- · 在Delphi编程中获取操作系统信息
- · 赶超印度应是中国软件业发展方向吗?
- · 多媒体和网络时代中,C++,Delphi,Java,还是C#?
- · 谁需要软件“蓝领”?
- · 入世对我国软件产业的影响及对策
- · 从印度软件产业看中国软件产业现状
- · 做一个自己的任务栏
- · 使用Delphi,SDK编写Windows简单程序
- · 软件登录的几种实现方法
- · 用 API 做的 ServerSocket 例子
- · QuickReport基本知识
