Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 01-08-2001, 04:02 PM
BlakeBlake BlakeBlake is offline
Senior Member
 
Join Date: Jan 2001
Posts: 156
Default Ways to shrink Delphi Executable size

OK, I have seen some things in delphi that have loads of functionality being smaller than the size of a blank executable containing just a form.
How do people achieve such a small executable size, any tips ?
Reply With Quote
  #2  
Old 01-08-2001, 04:23 PM
douglas douglas is offline
Senior Member
 
Join Date: Jul 2001
Posts: 7,695
Default RE: Ways to shrink Delphi Executable size

You have a couple of options:

1) Get an EXE shrinker - basically compressing the file and then decompress as it runs.

See:
http://www.blinkinc.com (Shrinker)
http://www.neoworx.com(NeoLite)
http://www.aspack.com (ASPack)

2) Don't use the VCL to program with. It is much harder though.

Try this as an example: (example from http://www.delphi32.co.yu/preuzeti_tekstovi/raw_api_programming.htm)

New | Application in Delphi. Then subtract the form. Save your program as SmallEXE. Then copy the following code and paste over Project | View Source.

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.

This program will create a window that will be only 19 KB. The website mentioned above explains all about it.

Hope this helps you!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 11:51 PM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.