Purpose, use resource files in Delphi
This example is to add a Flash animation to our program and release it when the program starts.
Create a new file first
Write content:Flash SwfFile1 Thanks.SWF
Save as:SwfFile.rc
Then use brcc32.exe to generate the resource file.res
Then add a line (last line) in Delphi
Implementation
{$R *.dfm}
{$R SwfFile.RES}//This is the line
Then add a PRocedure:
procedure FlashResToFile(const ResName, ResType, FileName: string);
var
FlashRes: TResourceStream;
Begin
FlashRes := TResourceStream.Create(HInstance, ResName, PChar(ResType));
try
FlashRes.SaveToFile(FileName); //Save the resource as a file, that is, restore the file
Finally
FlashRes.Free;
end;
end;
use:
FlashResToFile('FLASH', 'SwfFile1', 'Thanks.SWF');
ShockwaveFlash1.Movie := ExtractFilePath(ParamStr(0)) + 'Thanks.SWF';
ShockwaveFlash1.Play;