Link to home
Start Free TrialLog in
Avatar of fleeb
fleeb

asked on

Formless app with icon?

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?
Avatar of jameshui
jameshui

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.

Avatar of fleeb

ASKER

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.

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.

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.
Avatar of fleeb

ASKER

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 :)
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.
Avatar of fleeb

ASKER

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.

Yes, I can.  The strange thing is that it isn't the Delphi icon, it's  the MS-DOS icon!
ASKER CERTIFIED SOLUTION
Avatar of sperling
sperling

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of fleeb

ASKER

Duh! I figured it would be something obvious :)
Thanks.