荟萃版中的E文资料是开发技巧和文章,不是中文也没有关系。 问题的标题已经翻译成中文。 比如: Embedding files in a program 将文件嵌入到程序中 回答是这样的: E文的前后是一些简单的解释。主要是代码 TResHeader = record DataSize: DWORD; // size of our data HeaderSize: DWORD; // size of this record ResType: DWORD; // lo word = $FFFF => ordinal ResId: DWORD; // lo word = $FFFF => ordinal DataVersion: DWORD; // * MemoryFlags: WORD; LanguageId: WORD; // * Version: DWORD; // * Characteristics: DWORD; // * end;We will not be using the fields ed *.Here's the code that creates the resource file and copies in a given file:procedure CreateResourceFile( DataFile, ResFile: string; // file names ResID: Integer // id of resource ); var FS, RS: TFileStream; FileHeader, ResHeader: TResHeader; Padding: array[0..SizeOf(DWORD)-1] of Byte; begin { Open input file and create resource file } FS := TFileStream.Create( // to read data file DataFile, fmOpenRead); RS := TFileStream.Create( // to write res file ResFile, fmCreate); { Create res file header - all zeros except for HeaderSize, ResType and ResID } FillChar(FileHeader, SizeOf(FileHeader), #0); FileHeader.HeaderSize := SizeOf(FileHeader); FileHeader.ResId := $0000FFFF; FileHeader.ResType := $0000FFFF; { Create data header for RC_DATA file NOTE: to create more than one resource just repeat the following process, using a different resource ID each time } FillChar(ResHeader, SizeOf(ResHeader), #0); ResHeader.HeaderSize := SizeOf(ResHeader); // resource id - FFFF says "not a string!" ResHeader.ResId := $0000FFFF or (ResId shl 16); // resource type - RT_RCDATA (from Windows unit) ResHeader.ResType := $0000FFFF or (WORD(RT_RCDATA) shl 16); // data file size is size of file ResHeader.DataSize := FS.Size; // set required memory flags ResHeader.MemoryFlags := $0030; { Write the headers to the resource file } RS.WriteBuffer(FileHeader, sizeof(FileHeader)); RS.WriteBuffer(ResHeader, sizeof(ResHeader)); { Copy the file into the resource } RS.CopyFrom(FS, FS.Size); { Pad data out to DWORD boundary - any old rubbish will do!} if FS.Size mod SizeOf(DWORD) <> 0 then RS.WriteBuffer(Padding, SizeOf(DWORD) - FS.Size mod SizeOf(DWORD)); { Close the files } FS.Free; RS.Free; end; 我相信程序员都看的懂。 我下面列举一些问题,问题的回答大部分都是代码,我的不贴上来了。 How to add a true type font to the system 怎样在系统中增加一个true type字体Checking for Large fonts in windows 在windows中检测大字体List of Windows installed applications Windows已安装应用程序列表AVL-tree generic classes. 关于通用二叉平均树类Simulate Mouse Clicks and Moves 模仿鼠标点击和移动How get notifications on changes at the filesystem 怎样在文件系统改变后得到通知How to list all running processes 怎样列出所有正在运行的任务Finding all computers in a workgroup. 在一个工作组里找到所有计算机How to create an ActiveX and link it to JavaScript in an HTML document. 在HTML文件中怎样创建一个ActiveX并把它链接到JavaScriptTesting if you are connected to the internet 测试是否连接了internet等等,类似的文章有5000篇。关于C++Build的问题,C++Build使用的是Delphi的控件。对于技巧和开发文章,是delphi还是C++build应该没有什么关系
问题的标题已经翻译成中文。
比如:
Embedding files in a program
将文件嵌入到程序中
回答是这样的:
E文的前后是一些简单的解释。主要是代码
TResHeader = record
DataSize: DWORD; // size of our data
HeaderSize: DWORD; // size of this record
ResType: DWORD; // lo word = $FFFF => ordinal
ResId: DWORD; // lo word = $FFFF => ordinal
DataVersion: DWORD; // *
MemoryFlags: WORD;
LanguageId: WORD; // *
Version: DWORD; // *
Characteristics: DWORD; // *
end;We will not be using the fields ed *.Here's the code that creates the resource file and copies in a given file:procedure CreateResourceFile(
DataFile, ResFile: string; // file names
ResID: Integer // id of resource
);
var
FS, RS: TFileStream;
FileHeader, ResHeader: TResHeader;
Padding: array[0..SizeOf(DWORD)-1] of Byte;
begin { Open input file and create resource file }
FS := TFileStream.Create( // to read data file
DataFile, fmOpenRead);
RS := TFileStream.Create( // to write res file
ResFile, fmCreate); { Create res file header - all zeros except
for HeaderSize, ResType and ResID }
FillChar(FileHeader, SizeOf(FileHeader), #0);
FileHeader.HeaderSize := SizeOf(FileHeader);
FileHeader.ResId := $0000FFFF;
FileHeader.ResType := $0000FFFF; { Create data header for RC_DATA file
NOTE: to create more than one resource just
repeat the following process, using a different
resource ID each time }
FillChar(ResHeader, SizeOf(ResHeader), #0);
ResHeader.HeaderSize := SizeOf(ResHeader);
// resource id - FFFF says "not a string!"
ResHeader.ResId := $0000FFFF or (ResId shl 16);
// resource type - RT_RCDATA (from Windows unit)
ResHeader.ResType := $0000FFFF
or (WORD(RT_RCDATA) shl 16);
// data file size is size of file
ResHeader.DataSize := FS.Size;
// set required memory flags
ResHeader.MemoryFlags := $0030; { Write the headers to the resource file }
RS.WriteBuffer(FileHeader, sizeof(FileHeader));
RS.WriteBuffer(ResHeader, sizeof(ResHeader)); { Copy the file into the resource }
RS.CopyFrom(FS, FS.Size); { Pad data out to DWORD boundary - any old
rubbish will do!}
if FS.Size mod SizeOf(DWORD) <> 0 then
RS.WriteBuffer(Padding, SizeOf(DWORD) -
FS.Size mod SizeOf(DWORD)); { Close the files }
FS.Free;
RS.Free;
end;
我相信程序员都看的懂。
我下面列举一些问题,问题的回答大部分都是代码,我的不贴上来了。
How to add a true type font to the system
怎样在系统中增加一个true type字体Checking for Large fonts in windows
在windows中检测大字体List of Windows installed applications
Windows已安装应用程序列表AVL-tree generic classes.
关于通用二叉平均树类Simulate Mouse Clicks and Moves
模仿鼠标点击和移动How get notifications on changes at the filesystem
怎样在文件系统改变后得到通知How to list all running processes
怎样列出所有正在运行的任务Finding all computers in a workgroup.
在一个工作组里找到所有计算机How to create an ActiveX and link it to JavaScript in an HTML document.
在HTML文件中怎样创建一个ActiveX并把它链接到JavaScriptTesting if you are connected to the internet
测试是否连接了internet等等,类似的文章有5000篇。关于C++Build的问题,C++Build使用的是Delphi的控件。对于技巧和开发文章,是delphi还是C++build应该没有什么关系