Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 253
  • Last Modified:

delete properties and methods...?

Hi all,

I'm using Delphi2 for something i want to be as SMALL as possible.

I'm using Delphi only as a hobby, so i'm not a pro...

I know almost nothing about OO.

Since i want my program to be VERY small, is it possible to delete properties and/or methods i don't use, and by doing so reducing the EXE size ?
Example :
I don't use the cursor and PopupMenu (and others) properties and everything related to them.
and from the "Dialogs" unit i ONLY use MessageBox (and of course i'm not talking only about the "Dialogs" unit)
So... can i delete what i DON'T need?

If it can be done please give me a GOOD example.

ThanX
0
ebi1
Asked:
ebi1
  • 4
  • 2
  • 2
  • +2
1 Solution
 
ebi1Author Commented:
BTW : I use "Resource Hacker" and UPX (level 9) to reduce my EXE.

I have a Gouge, RxLib Animated GIF (24k), a few labels and a button.

Acording to what someone once told me - I use Frames instead of Panels to avoid the use of Handle (memory/size).

After all that i can't get my EXE file lower then 145k.

Please help.
ThanX
0
 
ebi1Author Commented:
BTW : I use "Resource Hacker" and UPX (level 9) to reduce my EXE.

I have a Gouge, RxLib Animated GIF (24k), a few labels and a button.

Acording to what someone once told me - I use Frames instead of Panels to avoid the use of Handle (memory/size).

After all that i can't get my EXE file lower then 145k.

Please help.
ThanX
0
 
ebi1Author Commented:
sorry i meant Bevel not frames...

Sorry about my English
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
robert_marquardtCommented:
The best way is to completely drop the use of the VCL. There are free replacements out there which allow to drop EXE size considerably. Have a look at Torry's Pages and Delphi Super Page.
0
 
Slick812Commented:
I often comment out things in my uses clause to see if they are needed

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, {Dialogs,} Buttons, StdCtrls;

if it will compile with the unit commented out then I delete it because it is no longer nessary. If you really want to get the smallest file size then you will need to do API without the Forms unit, but that takes time to learn, you can look at my web site to see if you want to try and do that

http://www.angelfire.com/hi5/delphizeus/

if you use the Forms unit, even with Delphi2 and the UPX you can't get much below 150 Kb. With API many programs are below 100 Kb and then below 50 KB with UPX.
0
 
robert_marquardtCommented:
Keep in mind that EXE size does not mean much to Windows. The memory footprint is quite another question.
EXEs are only loaded partly into memory. Using Quick Report for example easily makes 1.5 MB EXEs. Most of the code is not permanently loaded.
0
 
GwenaCommented:
Hi :-)



  If you want small exe size above all then you need to use the Key Objects Library ..  http://bonanzas.rinet.ru/

If you use KOL and also use the substitute system.dcu then you can get a delphi app down quite a bit less than 20kb.

If you then UPX with the highest compression level
UPX --best MyProgram.exe then you can get below 15kb easily

There are a few other tricks to squeeze even more out but once you are under 20kb then what does it really matter... that's like only a few seconds to download even on a 56k modem :-)

To get an exe below 10kb you can use the free BCX (basic to C convertor)  this uses the great freeware lcc C compiler.  If you upx the BCX exe files you can get under 5kb for a useful gui utility program... and that is pretty small.

To get below 3kb for a useful exe then you need to go to Win32 Assembly language... there is a nice free RAD development kit that uses the free nasm compiler to make windows gui programs.. http://www.visual-assembler.pt.vu/

And believe it or not you can even find ways to make the <3kb asm windows apps smaller!  and you can find plenty of space inside them to stuff data... it's amazing :-)


The reason a gui windows program can be so small is because you are calling code from windows dll's to do all the hard work... if you develop a taste for tiny apps then I suggest you try to learn all you can about the windows API... once you understand the API you can easily make small programs. Most of the code to make nice windows apps is just waiting inside the windows dll's for you to call.


to summarize...
The 4 ways that I use to make small exe files.
These are figures for a small util app like a
file patcher or file editor..etc

-Delphi 2 and then upx  ---> about 110kb
-Delphi and KOL library w/system dcu ---> about 20kb
-BCX and lcc ---> about 10kb
-C program using API ---> about 6kb
-Win32 asm ---> about 3kb

0
 
adengCommented:
Where can I find UPX ? is it freeware ?

Regards
Adeng
0
 
Slick812Commented:
here is one page addy for UPX a FREE .exe packer

http://upx.sourceforge.net/
0
 
GwenaCommented:
UPX is great for single instance executables..

But remember that if your exe will have many instances running at the same time that each will occupy memory if it is compressed...when an exe is uncompressed all the instances will use the same original image in ram.

just something to keep in mind :-)
0
 
ebi1Author Commented:
Hey there,

Sorry about the delay guys, I totaly forgot about this question...

Nobody actualy answered my question but I never knew about the KOL so for me it's a BIG thing...

Thank you Gwena, helpful as always...   :)

Slick - you will also get some points because i learned many good things from your site.
Thank you
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now