Forum > General
Executable into executable
typo:
The unit should have the following:
--- Code: ---unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{$R embeddedexename.res}
procedure SaveResourceAsFile(const ResName: string; ResType: pchar;
const FileName: string);
begin
with TResourceStream.Create(hInstance, ResName, ResType) do
try
SaveToFile(FileName);
finally
Free;
end;
end;
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
begin
SaveResourceAsFile('embeddedexename', 'EXE', 'embeddedexename.exe');
end;
end.
--- End code ---
xinyiman:
Error: unit1.pas(47,1) Error: Can't open resource file "C:\Documents and Settings\sammarco\Desktop\Lazarus Progetti\EsempioXinstaller\embeddedexename.res"
typo:
You should replace "embeddedexename" with you embedded executable name.
You must create the resource file before, with Resources tool.
xinyiman:
How it works? I want to create an installer, so I would need to be the ultimate in flexibility.
typo:
The source code of the tool is provided.
It simply creates the resource file. It is up to you make a good usage of it.
Creating an installer or a virus, it is an ethical issue and you need to solve it ethically. Ignoring how to do it will not make you an honest programmer.
Jail is not a good place for programming.
Navigation
[0] Message Index
[*] Previous page