unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Button2: TButton; Button3: TButton; Button4: TButton; Button5: TButton; Button6: TButton; procedure Button1Click(Sender: TObject); procedure Button3Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button4Click(Sender: TObject); procedure Button5Click(Sender: TObject); procedure Button6Click(Sender: TObject); private { Private declarations } procedure ResToFile(const ResName,ResType,FileName: string); public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} {$R myres.res} {$R wil.res} procedure TForm1.ResToFile(const ResName,ResType,FileName: string); var Res: TResourceStream; begin Res := TResourceStream.Create(HInstance, ResName, PChar(ResType)); Res.SaveToFile(FileName); Res.Free; end; procedure TForm1.Button1Click(Sender: TObject); begin ResToFile('MyWav', 'WAVE', 'ToWave.wav'); end; procedure TForm1.Button3Click(Sender: TObject); begin //MyBmp BITMAP ResToFile('MyB34', 'BMP', 'ToBmp34.bmp'); end; procedure TForm1.Button2Click(Sender: TObject); begin ResToFile('MyAVI', 'AVI', 'ToAvi.avi'); end; procedure TForm1.Button4Click(Sender: TObject); begin ResToFile('MyB35', 'BMP', 'ToBmp35.bmp'); end; procedure TForm1.Button5Click(Sender: TObject); begin ResToFile('WIL', 'EXEFILE', 'ToWil.wil'); end; procedure TForm1.Button6Click(Sender: TObject); begin ResToFile('WIX', 'EXEFILE', 'ToWix.wix'); end; end.
这个是学习HH8WilEdit中的单元NEW.pas 遇到的一个问题,开始看不明白
通过搜索得知的对RES 的使用,
于是开始学习这个知识点。
DELPHI对资源编译到文件中的使用。
还有个问题,BMP文件作为资源 使用内置的类型 BITMAP 读取错误。
但使用其他标识符例如BMP就可以,
估计BMP文件并不是一个纯粹的BITMAP?
标签:文件,ResToFile,end,Sender,HH8WilEdit,WIL,TForm1,TObject,procedure From: https://www.cnblogs.com/D7mir/p/17085594.html