Make program shorter...

People can someboduy help me?
Are there any way to make EXE program I compile with Delphi 4.0 as short as possable? How much short I can make it?

Thank's
mmilanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

intheCommented:
hi,
dont compile with packages(although first time deployment on some pcs may require some of the runtime libs to be deployed also),remove debugging info..
remove as many files from uses (ie if you only need one or two const from a unit use the consts in your program instead )

There is a program called Shrinker available. It compresses .EXE files and incorporates its expansion code into the file. It does a rather good job of compressing larger .EXE files.
http://www.aeronaut.com.au/hys_html/hys/Prod0153.htm
0
DrDelphiCommented:
you definitely SHOULD do  turn off the compile with debug information. This can really bloat an otherwise slim application. Also, if you are using any resources, such as bitmaps,wav's etc... you might want to look at compiling them separately as resource files. This way they don't bog down the application when not being used.

 

0
candoCommented:
jordan russel wrote a strip relocator program the takes a few kb off.
0
Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Alisher_NCommented:
In addition to mentioned options also
you can refuse of working with Delphi Visual Components Library and use
only Windows API calls, in this case
your .EXE will be at least 250 Kbytes
less, but you have to do all form
design job manually (using resource
workshop program for example)
So, it takes much more time.
If you want to get really tiny .EXE
use Assembler instead! ;-)

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mmilanAuthor Commented:
Ok, here you are points but can yo explain in much better?
0
Alisher_NCommented:
when you create new application try to set Application type to 'console' (no forms at all! ) remove all units from 'uses', make empty code and compile, look at .EXE size, you will get 16kb or around this.

If you really need a window with controls or something you may create one through API calls, something like this:
Function CreateScreenSaverWindow(Width,Height : Integer;  
  ParentWindow : hWnd) : hWnd;
Var WC : TWndClass;
Begin
  With WC do Begin
    Style := cs_ParentDC;
    lpfnWndProc := @PreviewWndProc;
    cbClsExtra := 0;  cbWndExtra := 0; hIcon := 0; hCursor := 0;
    hbrBackground := 0; lpszMenuName := nil;
    lpszClassName := 'MyDelphiScreenSaverClass';
    hInstance := System.hInstance;
  end;
  RegisterClass(WC);
  If (ParentWindow  0) Then
    Result := CreateWindow('MyDelphiScreenSaverClass','MySaver',
      ws_Child Or ws_Visible or ws_Disabled,0,0,
      Width,Height,ParentWindow,0,hInstance,nil)
  Else Begin
    Result := CreateWindow('MyDelphiScreenSaverClass','MySaver',
      ws_Visible or ws_Popup,0,0,Width,Height, 0,0,hInstance,nil);
    SetWindowPos(Result,hwnd_TopMost,0,0,0,0,swp_NoMove or swp_NoSize or swp_NoRedraw);
  End;
  PreviewWindow := Result;
End;

for window data you can use Resource Workshop (borland pascal part), your data will be in .RC file like this
SaverSettingsDlg DIALOG 70, 130, 166, 75
STYLE WS_POPUP | WS_DLGFRAME | WS_SYSMENU
CAPTION "Settings for Boxes"
FONT 8, "MS Sans Serif"
BEGIN
    DEFPUSHBUTTON "OK", 5, 115, 6, 46, 16
    PUSHBUTTON "Cancel", 6, 115, 28, 46, 16
      CTEXT "Box &Color:", 3, 2, 30, 39, 9
    COMBOBOX 4, 4, 40, 104, 50, CBS_DROPDOWNLIST | CBS_HASSTRINGS
    CTEXT "Box &Type:", 1, 4, 3, 36, 9
    COMBOBOX 2, 5, 12, 103, 50, CBS_DROPDOWNLIST | CBS_HASSTRINGS
    LTEXT "Boxes Screen Saver for Win32 Copyright (c) 1996 Jani
           Järvinen.", 7, 4, 57, 103, 16,
           WS_CHILD | WS_VISIBLE | WS_GROUP
END

are you really need this ? you save A LOT time using VCL, is the size really so critical ? what is the application is this ?
0
mmilanAuthor Commented:
No it's not important for me now to make so short program. I just asked to see how can I do that. Thank's
0
bryan7Commented:
listenning
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.