Solved

Formless app with icon?

Posted on 1997-04-06
10
320 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
  • 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
 
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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

758 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

Need Help in Real-Time?

Connect with top rated Experts

27 Experts available now in Live!

Get 1:1 Help Now