Author Topic: Adding An Icon To Your Executables!  (Read 12411 times)

0 Members and 1 Guest are viewing this topic.

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Adding An Icon To Your Executables!
« on: July 06, 2009 »
Introduction:
As the topic implies this little thang will allow you to add an identity to your FreeBASIC proggies.


What You'll Need:
An icon image file .ico - A few are supplied to Transform your .exe's, see zip attachment.
A text editor Note Pad is just grand.
Optional: A paint package that allows the ability to churn out .ico files or better still an icon editor.


Before We Start:
By adding an icon it will increase your overall program file size.

I've supplied a zip archive of some icons for you to have a play with, there are a lot of freebies available if you search the web for them.

Also use icons in the size of 32 by 32. I've tried with bigger sizes but they get resized when the object file is created and your program is compiled.


Lettuce Begin:
First of all save / copy and paste your icon into the program you wish to add the particular icon to, if you want to add it to your media / graphics folder than just remember to put the directory path into the icon file location.

Now open up Notepad or your prefered weapon of choice in the text editor department and type in the following:

Code: [Select]
fb_program_icon icon "name_of_icon.ico"

Nows time to navigate to save, and select to save it as all types of files in the drop down menu, important this part, otherwize you'll be creating a text document rather than the actual type of file we need.

And call it a suitable name, for example add_icon followed by a dot rc and make sure you save it into your main programs root directory.


And Finally!
In FBIDE -> View -> Settings -> FreeBASIC

Under Compiler Command in the tab along side your usual compiler settings, at the end enter in quotes "add_icon.rc" ( By the way same similar scenario with compiling on the command prompt )

And now OK it, when you next compile with F9 ( not F5 ) your program executable should now have a neat piccie applied!!


Extra Extra!:
Ico FX - free icon utility and really awesome allows you to import your own images and apply settings to convert into icons. Thanks to Xone for posting the link in another thread.

Known Issues
If you are using fbgfx lib then you will see a smaller icon on your windows title bar when not in full screen mode. However in TinyPTC / TinyPTC_Ext you will just have an icon applied to your exe.

Cheers and Happy Coding,
Clyde.
« Last Edit: July 08, 2009 by Clyde »
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline DrewPee

  • I Toast Therefore I am
  • Pentium
  • *****
  • Posts: 563
  • Karma: 25
  • Eat Cheese - It's good for you!
    • View Profile
    • Retro Computer Museum
Re: Adding An Icon To Your Executables!
« Reply #1 on: September 09, 2009 »
Nice one Clyde - didn't know you could do that! ;)   :goodpost:
DrewPee
aka Falcon of The Lost Boyz (Amiga)
Ex-Amiga Coder and Graphic Designer
Administrator of > www.retrocomputermuseum.co.uk

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Adding An Icon To Your Executables!
« Reply #2 on: September 23, 2009 »
Thanks Man and now you do!! ;)
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline bobfresh

  • C= 64
  • **
  • Posts: 40
  • Karma: 5
    • View Profile
Re: Adding An Icon To Your Executables!
« Reply #3 on: March 03, 2010 »
Quick side note/question.

If I try adding an XP+ manifest to the executables resource section, it generates a program error!!
added: the error is in the generated exe not in GoRC or FBC. also the same problem is not repeatable in my other language -masm32.

Conveniently i found a picture that depicts the effect on the exe alot better than i could describe it...

it looks a bit like this....  :boxer:   

Does anyone have a fix for this that doesn't involve adding a myprog.exe.manifest to the directory?

thx in advance - bob
« Last Edit: March 03, 2010 by bobfresh »

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2757
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: Adding An Icon To Your Executables!
« Reply #4 on: March 03, 2010 »
I'm not sure but maybe you're using a wrong manifest file?

Check this out, I used some examples found here and here.



Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Adding An Icon To Your Executables!
« Reply #5 on: March 03, 2010 »
I see, a password system.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline bobfresh

  • C= 64
  • **
  • Posts: 40
  • Karma: 5
    • View Profile
Re: Adding An Icon To Your Executables!
« Reply #6 on: March 12, 2010 »
rzb yup that fixed it alright.

I was using an old hacked up XP manifest that ive been using for years on masm32 w/ no issues. Strange that it only kicked off when embedded in the RSRC section though... meh.  I only need windows to 'skin' the std controls like buttons and listboxes .etc. so that example is perfect.

          Thanks for that.
« Last Edit: March 12, 2010 by bobfresh »