Solved

Formless app with icon?

Posted on 1997-04-06
10
327 Views
Last Modified: 2010-04-06
I have written a simple program which has no forms, and it doesnt have an icon.  Is it possible to add an icon to it, or to a console app for that matter?
0
Comment
Question by:fleeb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +1
10 Comments
 

Expert Comment

by:jameshui
ID: 1335204
Yes, of course you can.
Any programme written in Delphi can have an Icon for it.
1. Select "Project" from Delphi's Options menu.
2. Under the sub-menu "Application".
3. Browse the Icon you want in "Load icon" button.

Hope it helps.

0
 

Author Comment

by:fleeb
ID: 1335205
I can get that to work fine for apps which have forms, but it doesnt work for console programs (at least I cant get it to), and it doesnt seem to work for apps that have no forms either.

0
 
LVL 1

Expert Comment

by:sleach
ID: 1335206
I just tested making an app without any forms.  I added a custom Icon.  Everything works fine.  

Could it be that your program is terminating before it appears on the taskbar?

Do you see ANY icon at all?
You should see the default Delphi icon for at a minimum.  If you don't, your problem lies elsewhere.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Expert Comment

by:sperling
ID: 1335207

If you use the unit Forms anywhere in your project, the standard Delphi icon will be visible. This also increases the size of your EXE though.

If this wasn't the problem leave me a comment with the following info:
  Is this Delphi 1 or 2?
  Do you compile as a console app or as a GUI app?

Reagrds,

Erik.
0
 

Author Comment

by:fleeb
ID: 1335208
Umm.. I'm doing stuff without forms, either Console programs or GUI programs that have no forms (kinda defeats the purpose of a GUI app dont you think? :)
It is just a simple program that sits in my startup folder and edits the registry every time I use Windows (on a network you see).  It is basically a console program with no I/O and the compiler directive: {$APPTYPE GUI}
That gives me an 8k app that runs transparently, with no forms, and consequently, nothing on the taskbar.  Only problem is that when I view the startup folder, the app has no icon! (not _that_ important, but I'd like to add one just the same).
I am using Delphi 2 (Client/Server, not that it will make much difference..)
I hope that explains a bit better what I'm doing.
Any more ideas? (100 points at stake here :)
0
 
LVL 3

Expert Comment

by:sperling
ID: 1335209
Hmmm. I can't reconstruct your problem... No matter what I do, my app gets an embedded icon.

Try the good old "Delete all generated files and Build All"

If that doesn't help, I don't know...

Regards,

Erik.
0
 

Author Comment

by:fleeb
ID: 1335210
I still cant get it to work..
I cant think of any other way of explaining exactly what I'm doing (I'm sure there is something I'm not doing you see).
Here is an example app, about as simple as you can get.
Compile this with Delphi 2 and see if you can get a 7 - 8k app WITH an icon (either the default Delphi on, or another).

//this is the project source.  It is the whole code. No forms.
program test;
{$APPTYPE CONSOLE}
uses windows; //this is cos Delphi seems to want you to use at                 //least one unit (try changing project options with               //no uses clause)
BEGIN
     writeln('Do I have the default Delphi Icon?');
     readln;
END.

See if you can get an icon on that.

0
 
LVL 1

Expert Comment

by:sleach
ID: 1335211
Yes, I can.  The strange thing is that it isn't the Delphi icon, it's  the MS-DOS icon!
0
 
LVL 3

Accepted Solution

by:
sperling earned 50 total points
ID: 1335212
program test;

uses
  Windows;

{$R *.RES}

{$APPTYPE CONSOLE}


;) This'll include the icon. You've left out the {$R *.RES}, therefore the linker don't include the resource file where the icon is located....


Regards,

Erik.


0
 

Author Comment

by:fleeb
ID: 1335213
Duh! I figured it would be something obvious :)
Thanks.

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

739 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