Solved

Formless app with icon?

Posted on 1997-04-06
10
324 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

778 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