return
                                                               
Download this example: example-standalone.tar.gz          (works only with InstallMade version 1.0.1-4 and above)
Download InstallMade Post-Processor version 1.0.1-4
                      

{----------------------------------------------------------------------
          InstallMade's Standalone Executable - How-To example

- 03/04/2003 This example demonstrates how to utilize InstallMade's capabilities of reducing the total size of deployed executable by referencing to dynamically loaded data source; double-compressed and stored in the body of the Standalone Executable.

This example uses a directory "DataPicture" with four jpg files and one index file. However, in a real life application the directory can contain many different files and or multiple directories with different content. This whole directory will be compressed along with all the files in it, during the creation of InstallMade's Compressed  Standalone Executable and place in the body of the executable.

During the execution of the application the content of this directory will be decompressed into a spawned spool area and can be readily accessed by the application in a similar manner as any other file on the system.

This approach can reduce substantially the overall size of the executable, as much as 10 times of the actual size of the content, if loaded into the application Form during designed-time and deployed traditionally.

Additionally, the standalone executable provides the protection for the content (read-only) and the convenience of one file deployment.

Copyright SuperObject Software Solutions. All Rights Reserved. support@superobject.com

---------------------------------------------------------------------}


unit
Unit1;

interface

uses
  SysUtils, QGraphics, QControls, QForms,
  QStdCtrls, Classes, QExtCtrls, Libc;

{-------------------------------------------------------------------
 The application will use libc function getenv() so we add the
 Libc to the uses..
 ------------------------------------------------------------------- }

type
  TForm1 = class(TForm)
    Image1: TImage;
    Image2: TImage;
    Panel1: TPanel;
    ComboBox1: TComboBox;
    procedure FormCreate(Sender: TObject);
    procedure ComboBox1Change(Sender: TObject);
  private
     { Private declarations }
  public

   spPath, h : string;

 {---------------------------------------------------------------
  The "spPath" variable will hold the standalone's spool path
  the "h"  variable will hold the home path
  -------------------------------------------------------------- }

  end;

var
  Form1: TForm1;

implementation

{$R *.xfm}



procedure TForm1.FormCreate(Sender: TObject);
begin

{-----------------------------------------------------------------

 Here.. in the FormCreate event, we get the values for "h" and "spPath".

Since the code should work during designed time and after
the executable is packaged with InstallMade to become InsatllMade's
compressed standalone executable we need to provide mechanism which will
allow this application to work inside the Kylix IDE and when deployed
------------------------------------------------------------------ }

h := libc.getenv('HOME');
spPath := libc.getenv('SP_CATCH');

{---------------------------------------------------------------------
 In this example the Project directory is /home/<user>/example-standalone
 and the graphical elements used in this application are stored in the
 subdirectory /home/<user>/example-standalone/DataPicture, then to be able
 access it in designed-time from this directory and during run-time from
 (unknown in designed-time) a spawned catch of InsatllMade's standalone
 executable, we will use this code to define the value of "spPath" variable.

 -----------------------------------------------------------------------}


if spPath = ''  then                     //true if run in the IDE
spPath := h + '/example-standalone';


Image2.Picture.LoadFromFile( spPath + '/DataPicture/app_baner.jpg');


 {----------------------------------------------------------------------
 Here. in this example we use an index file to load the filenames of the
 pictures and stored in the directory where the pictures are stored.
 ----------------------------------------------------------------------- }

ComboBox1.Items.LoadFromFile(spPath +'/DataPicture/PictureIndex.txt');

end;


procedure TForm1.ComboBox1Change(Sender: TObject);
begin

Image1.Picture.LoadFromFile(spPath +'/DataPicture/'+ComboBox1.Text);

end;

end.



example1.jpg


return