Solved

Formless app with icon?

Posted on 1997-04-06
10
321 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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 video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …

914 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

18 Experts available now in Live!

Get 1:1 Help Now