❶ 在Delphi里用什么方法生成一个.res文件
通常来说,在 delphi 里新建一个带窗体的工程(dpr),会自动生成同名的 .res 资源文件。
.res 资源文件可以通过以下方法生成:
1、编写 .rc 文件,再通过 BRCC32.EXE 转化 .Rc 文件成 .Res 文件。
.Rc 的文件是个纯文本文件,其内容的格式如下:
资源标识符 关键字 资源文件名
示例如:
MyWavWAVE"FileName.Wav"
MyAVIAVI"SpeedIs.AVI"
转换成 res 文件示例:
Brcc32Sample.Rc
Brcc32.exe 是 Borland Resource Compiler 工具软件,通常位置在 delphi 安装目录的 bin 路径下。
2、Delphi 低版本(d7)自带了一个叫 Image Editor 的工具,同样可以编辑资源文件。但高版本 delphi(2007及以后版本),这个工具软件取消了。
可以尝试下载 Image Editor 或是 WorkShop 、Resource Builder 等工具软件来完成 res 文件的编辑工作。
❷ DELPHI XE添加资源文件
WebBrowser1.Navigate('file:///C:/Users/SA/Documents/a.htm');
❸ delphi7无法生成rc资源文件
好象要加个路径吧.
❹ delphi 如何把文本文件作成资源文件
txt
rcdate
"c:\ghy.txt"保存成ghy.txt文件
,再改
扩展名
为rc的文件。brcc32
ghy.rc完成。祝:身体健康!
❺ delphi资源文件
1、创建rc文件。可以用任意文本编辑器来写。文件格式为:"资源名 资源类型 文件名"。
对于资源类型,如果是exe文件,应该是EXEFILE,如果是二进制文件,则是RCDATA。
这里创建一个文件float.rc:
代码
AEXE EXEFILE "E:\Software\float.exe"
这里顺便记得“AVI 无声动画
BITMAP 位图文件
CURSOR 光标文件
ICON 图标文件
WAVE 声音文件”
2、将这个rc文件转换成res文件。
执行brcc32 float.rc,生成float.res
3、将这个res文件包含至工程文件中。
代码
{$R float.res}
4、提取RES中的float.EXE。
代码
procere TFormMain.IEEE7541Click(Sender: TObject);
var
t : TResourceStream;
begin
if FileExists('float.exe') then
WinExec('float.exe',Sw_normal)
else
begin
try
t := TResourceStream.Create(HInstance,'AEXE','EXEFILE'); //其中HInstance为一个句柄常量;rwww为资源名;exefile为资源类型
t.SaveToFile('float.exe');
finally
t.free;
end;
WinExec('float.exe',Sw_normal);
end;
end;
❻ delphi 怎么新建文件
同意楼上的,有点笔误
myinifile.redainteger('小节名','关键字','缺省值');//读取整数型数据。
应为
myinifile.readinteger('小节名','关键字','缺省值');//读取整数型数据
创建一个文件的函数:
function FileCreate(const FileName: string): Integer;
Description
FileCreate creates a new file with the specified name. If the return value is positive, the function was successful and the value is the file handle of the new file. A return value of -1 indicates that an error occurred.
❼ delphi 如何把图片或者RES资源文件增加到已存在的EXE文件中
procereTForm1.Button1Click(Sender:TObject);
var
mstrm1:TMemoryStream;
update:dword;
workdir:string;
begin
workdir:=ExtractFilePath(ParamStr(0));
mstrm1:=TMemoryStream.Create;
mstrm1.LoadFromFile(workdir+'add.ico');//要添加的图标
mstrm1.Seek(0,soFromEnd);
mstrm1.Position:=0;
CopyFile(PChar(workdir+' est.exe'),PChar(workdir+' est_add.exe'),True);
update:=BeginUpdateResourceW(PWideChar(widestring(workdir+' est_add.exe')),False);
UpdateResourceW(update,PWideChar(RT_RCDATA),'ICORes',0,mstrm1.Memory,mstrm1.Size);
EndUpdateResourceW(update,False);
mstrm1.Free;
ShowMessage('配置完成了');
end;
❽ delphi中怎么生成一个TXT文档
procere Twrt_Form.N1Click(Sender: TObject);
var
myfile: Textfile;
s,str:string;
begin
richedit1.Text:='';
if opendialog1.Execute then //此处选择你要打开的文件
begin
caption:=opendialog1.FileName;
str:=opendialog1.FileName;
assignfile(myfile,str);
reset(myfile);
try
while not eof(myfile) do
begin
readln(myfile,s); //读文件
richedit1.Lines.Add(s);
end;
finally
closefile(myfile);
end;
end;
end;
❾ delphi创建文件和读取.ini文件怎么写
filecreate('路径加文件名');//创建一个文件。
读写ini文件:
先在 uses 定义 Inifiles, 在 var 定义 myinifile:Tinifile;
实现部分写代码:
myinifile:=Tinifile.create('d:\1.ini');//打开D盘的 1.ini 文件。
myinifile.readstring('小节名','关键字','缺省值');//读取字符型数据。
myinifile.redainteger('小节名','关键字','缺省值');//读取整数型数据。
myinifile.readbool('小节名','关键字','缺省值');//读取逻辑型数据。
写入INI文件:
myinifile.writestring('小节名','关键字',变量或字符串值);//写入字符型数据。
myinifile.writeinteger('小节名','关键字','变量或整型数值);//写入整数型数据。
myinifile.writebool('小节名','关键字',变量或TRUE或FALSE);//写入逻辑型数
myinifile.Free;//释放INI文件。
❿ 如何编译rc文件生成res资源文件 我用的是delphi,先谢过了!
Project -> add to project(Shift+F11)->选择RC文件(文件类型选择*.RC)->
Build-OK