View Full Version : how can i make my Delphi apps smaller??
paulholden
08-05-2001, 01:16 PM
for instance, when there is just a label or something on the form its already 200+Kb, i want to know how to make it as small as possible, by using special components? or getting rid of all the useless stuff i dont need, like from the uses clause or whatever....
does it make any difference if i create all the components i want at run time? instead of placing them on the form? or using no forms at all, can you still create virtual components like Memos and Listboxs ( just to hold data in )??
thanks.
Raver
08-05-2001, 01:32 PM
<tt>Hi
Use any component and anything else you want
in your application ;)
Then use one of these EXE COMPRESS program :
(THEY CAN COMPRESS YOUR EXE FILE)
</tt>
http://www.blinkinc.com (Shrinker)
http://www.neoworx.com (NeoLite)
http://www.aspack.com (ASPack)
<tt>
I recommend ASPACK , its very cool and easy to use ,
Its free for 30 days ;)
Good Luck
Bye
</tt>
paulholden
08-05-2001, 01:36 PM
hi, i know about these
but i was just wondering how i could make my exes smaller without using them.
thanks
Mucan
08-05-2001, 02:24 PM
Then, Some suggestion:
1-You may remove not used unit from uses clause.(coming with new project.)
2-You may use for compile: Delphi3 or Delphi2 (if you are coded simple program ).
Removing things from the uses clause is a good idea...here's how...what...and why you should get rid of it:
Windows - You might not need this on your form, it doesn't really contain anything that will make your exe larger cause the unused things in it will be excluded, but there's no point of removing it cause other units also use it...
Messages - Contains only constants...makes no extra size...you might not need this either if your program doesn't use Windows Messages...
SysUtils - Now THIS is a very large unit! And most of the time you don't need it in your form...(like you need it for LowerCase and stuff like that)...but there's no point of removing it cause other units always use it...I think it puts about 100 - 150 KBs on your exe:)
Classes - also a large one...you might not need it in your exe, but I think Delphi won't let you remove it...
Graphics - needed for graphics...colors...bitmaps...brushes...etc...try removing it...only thing that can happen is that you'll put it back...
Controls - You won't be able to remove this...it's needed for controls...
Forms - Don't remove it if you want to use forms in your application...
Dialogs - it's worth to remove if you don't want to use any dialogs...you can use Application.MessageBox instead of MessageDialog and ShowMessage...
StdCtrls - Can't remove...controls and stuff...
ComCtrls - Same as above...
----------------
Also you should try to use more WinAPI instead of Delphi stuff...and I can suggest you to use UPX...an exe compressor...it's very good on Delphi EXEs and easy to use you can get it at http://upx.tsx.org...
Good luck...:)
gLes:)
Always Coca-Cola!
If you want to make a really small EXE just to see what you can do with WinAPI try this code:
program SmallEXE;
uses
Messages,
Windows;
{$R *.RES}
const
AppName: array[0..10] of Char = 'HelloWinApp';
function WndProc(HWnd: HWND; Msg: UINT; wParam: WPARAM;
lParam: LPARAM): LRESULT; stdcall;
begin
case Msg of
WM_DESTROY:
begin
PostQuitMessage(0);
Result := 0;
end
else
Result := DefWindowProc(HWnd, Msg, WParam, LParam);
end;
end;
var
C: TWndClass;
Handle: HWND;
Msg: TMsg;
Result: Integer;
begin
with C do begin
style := CS_VREDRAW or CS_HREDRAW;
lpfnWndProc := @WndProc;
cbClsExtra := 0;
cbWndExtra := 0;
C.hInstance := HInstance;
hIcon := LoadIcon(HInstance, IDI_APPLICATION);
hCursor := LoadCursor(HInstance, IDC_ARROW);
hbrBackground := GetStockObject(WHITE_BRUSH);
lpszMenuName := nil;
lpszClassName:= @AppName;
end;
RegisterClass(C);
Handle := CreateWindow(@AppName, 'Hello World!',
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, HInstance, nil);
ShowWindow(Handle, SW_NORMAL);
UpdateWindow(Handle);
while GetMessage(Msg,0,0,0) do begin
TranslateMessage(Msg);
DispatchMessage(Msg);
end;
end.
Look up CreateWindow in the Win32 to find some more interesting things on how to make windows:)
Good luck...
gLes:)
Always Coca-Cola!
henkjan
08-12-2001, 01:24 AM
the best thing is to get all empty procedures away in your program.
this already helps alot, but this only helps you to get about 50k with a large program.
the best option is to get away of some packets in your delphi app.
this you can do in the project,options section.
only be carefull how more you remove how harder its to run your programms on a computer where delphi isn`t installed.
the best way is always to use the smallest images.
and remove stuff you don`t use.
greetz,
shadow_tj
http://cyberentics.ath.cx
vBulletin® v3.8.7, Copyright ©2000-2013, vBulletin Solutions, Inc.