Solved

delete properties and methods...?

Posted on 2002-06-24
11
230 Views
Last Modified: 2010-04-04
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
Comment
Question by:ebi1
  • 4
  • 2
  • 2
  • +2
11 Comments
 

Author Comment

by:ebi1
ID: 7106366
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
 

Author Comment

by:ebi1
ID: 7106369
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
 

Author Comment

by:ebi1
ID: 7106409
sorry i meant Bevel not frames...

Sorry about my English
0
ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 
LVL 11

Expert Comment

by:robert_marquardt
ID: 7106499
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
 
LVL 33

Expert Comment

by:Slick812
ID: 7106523
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
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 7106609
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
 
LVL 5

Accepted Solution

by:
Gwena earned 200 total points
ID: 7106620
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
 
LVL 1

Expert Comment

by:adeng
ID: 7109503
Where can I find UPX ? is it freeware ?

Regards
Adeng
0
 
LVL 33

Expert Comment

by:Slick812
ID: 7111596
here is one page addy for UPX a FREE .exe packer

http://upx.sourceforge.net/
0
 
LVL 5

Expert Comment

by:Gwena
ID: 7111921
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
 

Author Comment

by:ebi1
ID: 7287460
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
add combobox item based on numbers 9 144
Communication Between RC4 Delphi <-> PHP 3 115
Delphi XE10 Round Image 2 128
MS Access from Delphi 31 32
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question