.DCR是什么样的文件?(100分)

小天

Unregistered / Unconfirmed
GUEST, unregistred user!
Delphi5程序编译后生成的.DCR是什么文件?
怎么样才能反编译或再利用呢?
 
是Delphi的控件资源文件——Component Resource File,主要是用来存放小图片的。
可以用Delphi自带的Image Editor打开它。


编译后生成的应该是.DCU文件吧。

Delphi .dcu format
How can I decompile a DCU file, so I may modify it to work with later versions of
Delphi / C++ Builder?
The DCU file format is undocumented and may change from version to version. You will
need the source code (.pas file) to modify/update the DCU. 7/ 6/98 4:3 :28 PM

Well, first of all, the .DCU file format is subject to change with every release of
Delphi. For previous Borland Pascal programmers this may not come as a surprise, since
the .TPU file format changed also with every major release of Turbo/Borland Pascal. But
the major reason is of course that Delphi-32 needs 32-bit code to be generated, and this
includes the .DCU file.

事实上也是这样:几乎每个版本的Delphi的DCU文件的格式都不一样,并且Borland没有进行任何
说明,所以反编译是很困难的。
 
DCR 实际上是资源文件,可以包含若干 24X24 大小16色的Bitmap,这些Bitmap只在设计时
用到,就是显示在Component Platte 中的那些代表控件的图标。当IDE 加载一个组件包
xxx.bpl 时,它会在该包所在的目录下查找一个名为 xxx.dcr 的文件,找到的话则加载
该文件,对于该包中名为 YYY 的 Component,会在该资源中查找名为 YYY 的资源项
(bitmap),找到则调用该资源项在 Component Platte 中绘图代表 YYY 这个组件。找不到
则使用缺省的 Bitmap 来绘图表示包中的组件。运行时不会用到这些 Bitmap,所以这种
文件不会被编译到 dcu 或 exe(bpl)中。
任何能打开 res 文件的工具应该都能打开 DCR 文件,打开后每一项都可以存为bmp文件的,
就可以再利用了。
 
那如何另存呢?我好象保存不了了

creation-zy:我怎么没有办法给你加分?
 
to 小天:
你可以从 File|New|Bitmap File 另外新建 一个 24X24 的 16色 bitmap 文件,再把
DCR 文件中的 Bitmap 全选拷贝过去,新的 bitmap 文件可以保存或另存为的,若要存为
其它格式的文件操作也类似吧。
 
to 小天:
我发现凡是我改过的贴子都得不到分,我已经开了一个贴子反映这个Bug。没法加就别加了。

至于图像的另存——Copy&Paste到画笔中去就可以了。
 
请版主帮我结束,分数给creation-zy
 
接受答案了.
 
顶部