Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 03-01-2002, 02:28 AM
Mancubus Mancubus is offline
Senior Member
 
Join Date: Jan 2001
Posts: 275
Default Why is this so big?!?!?!?

this is my ENTIRE application:

program Executor;

uses
Forms,
ShellApi;

{$R *.res}

begin
Application.Initialize;
Application.Run;
ShellExecute(Application.Handle, nil, PChar('www.delphipages.com'), nil, nil, 0);
end.

Its nearly 400KB.

It doesn't even have a form!
I'm guessing it is becuase of the linking needed for the TApplication class, in the forms unit.

The question is, how can I do this (run shellexecute) without needing an instance of TApplication?
How else can I create a window handle to pass in?

Cheers,
Dave.
Reply With Quote
  #2  
Old 03-01-2002, 02:33 AM
LörAn LörAn is offline
Senior Member
 
Join Date: Mar 2001
Posts: 1,506
Default RE: Why is this so big?!?!?!?

Try using the GetDesktopWindow() function which will return you the handle of the desktop :

program Project1;

uses
Windows,
ShellAPI;

{$R *.RES}

begin
ShellExecute(GetDesktopWindow(), nil, PChar('www.delphipages.com'), nil, nil, 0);
end.


It might be lighter.

LörAn.
MAIL: loran@superheros.as
ICQ : 112714184
Reply With Quote
  #3  
Old 03-01-2002, 02:38 AM
DarkHorse DarkHorse is offline
Senior Member
 
Join Date: Dec 2000
Posts: 1,636
Default RE: Why is this so big?!?!?!?

Hi,

Eventhough ur not using any forms, still u have referenced Forms unit in the uses Clause, which u dont require. The Application variable also u dotn require.

U require only the ShellApi unit. Try the following.

program Project1;

uses
ShellApi;

{$R *.RES}

begin
ShellExecute(0, nil, PChar('www.delphipages.com'), nil, nil, 0);
end.


Hope this will help.




Pls. accept if it helped.

Thanx
Tomy.
Reply With Quote
  #4  
Old 03-01-2002, 05:10 AM
luke_skywalker luke_skywalker is offline
Senior Member
 
Join Date: Jan 2001
Posts: 169
Default RE: Why is this so big?!?!?!?

The reason being is that you've implemented Forms unit. Remove it from the uses clause. Your uses clause should look something like:

uses SysUtils, ShellApi;

By the way, why don't you conver it into DOS-console application? It might even get smaller. Almost forgot, you are including a resource file, which every Windows program has {$R *.res}. Try removing it from the program, and compile it.

So your DOS console application would look something like this:

program Executor;
{$APPTYPE CONSOLE}
uses
SysUtils, ShellApi;


begin
ShellExecute(Application.Handle, nil, PChar('www.delphipages.com'), nil, nil, 0);
end.



The size should be now about 50K.
Reply With Quote
  #5  
Old 03-01-2002, 09:43 AM
HTML HTML is offline
Senior Member
 
Join Date: Jan 2001
Posts: 2,977
Default RE: Why is this so big?!?!?!?

Hello,



To make you exe smaller make sure "runtime packages"(packages tab) are checked and "use dynamic rtl(linker tab)", but you will have to distribute all library files with exe.

If you do decide to build without runtime packages. Only check the packages your application needs, like if you have a component package that you dont use any of those components in you application, uncheck it in the packages screen.

All these setting are configured in the Project Options Settings.
Reply With Quote
  #6  
Old 03-02-2002, 07:00 AM
DarkHorse DarkHorse is offline
Senior Member
 
Join Date: Dec 2000
Posts: 1,636
Default RE: Why is this so big?!?!?!?

Hi,

Ur prob is still unsolved ?

Pls. accept if it helped.

Thanx
Tomy.
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 01:58 AM.


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