❶ 在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