DelphiFAQ Home Search:
General :: Programming :: Delphi
General Delphi related information.

Articles:

This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.
Recommended links on this topic:
Featured Article

Reducing application EXE size

In a small project I tried to reduce the application's EXE size. It seemed that I needed to include unit Forms because I needed the application's startup directory.

I then remembered that ParamStr(0) contains the same information as Application.ExeName and my EXE file shrank from 290kB to 43kB.

After using UPX it now has a size of only 22kB!

// this version needs unit Forms
uses
   Forms;
 begin
   sPath := ExtractFilePath(Application.ExeName);
 end;
 
 // this version does not!
begin
   sPath := ExtractFilePath(ParamStr(0));
 end;
 
 
 
You don't like the formatting? Check out SourceCoder then!
Generated 0:02:07 on May 26, 2017