How do I change my program's icon?

This is a discussion on How do I change my program's icon? within the C++ Programming forums, part of the General Programming Boards category; I would like to know how to change the icon of my program (console application) from the default whiteboard-thing to ...

  1. #1
    Registered User
    Join Date
    Jul 2003
    Posts
    26

    Exclamation How do I change my program's icon?

    I would like to know how to change the icon of my program (console application) from the default whiteboard-thing to an icon of my choice. Any 'n all help is appreciated. Thanks.


    --mr0ldie
    --LiKWiD
    Becoming un-noobified one day at a time.

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    This is more a Windows question, but whatever.

    In explorer or on the desktop, your exe's icon is the first icon resource in the exe file. The icon of your window is the one you specify with the hIcon in the window class.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #3
    Registered User
    Join Date
    Jul 2003
    Posts
    26
    So, do I have to setup the Windows .. "stuff"? (I've tried Windows programming, but never done much with it since you had to add all the code at the beginning to set it up.) i.e., What do I need to include (files/code) to be able to change the icon?

    (not expecting you to write it for me, if you can hint it or direct me to a tutorial, I'd greatly appreciate it.)
    --LiKWiD
    Becoming un-noobified one day at a time.

  4. #4
    Been here, done that.
    Join Date
    May 2003
    Posts
    1,161
    It would help to know what compiler you are using. I'm sure each compiler has it's own way of embedding the icon in the .exe file.
    Definition: Politics -- Latin, from
    poly meaning many and
    tics meaning blood sucking parasites
    -- Tom Smothers

  5. #5
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Whether it's VC++, Borland Builder or Dev-C++, there must be an "add resource" command somewhere. Use it and add an icon resource to the project. Then use some icon editor (all three probably have one built-in) to draw whatever you want.

    When you next compile, the icon should be embedded.

    It's not as easy for command-line compilers.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  6. #6
    essence of digital xddxogm3's Avatar
    Join Date
    Sep 2003
    Posts
    589
    I'm using VC++.NET7.
    Would you know what the icon editor is named?
    "Add Resource" is that the command name?
    I do not have my compiler to search, but would help pull the needed details from just typing "Add Resource"?
    This sounds like a cool thing to have on my programs.
    Good thread.
    "Hence to fight and conquer in all your battles is not supreme excellence;
    supreme excellence consists in breaking the enemy's resistance without fighting."
    Art of War Sun Tzu

  7. #7
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Project->Add Resource->Icon
    adds an icon resource to your app.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  8. #8
    essence of digital xddxogm3's Avatar
    Join Date
    Sep 2003
    Posts
    589
    This thread kicks @$$.
    I just created my first custom program icon.
    Thanks to everyone that participated in this thread.
    "Hence to fight and conquer in all your battles is not supreme excellence;
    supreme excellence consists in breaking the enemy's resistance without fighting."
    Art of War Sun Tzu

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with Icon Changer
    By Tughack in forum C Programming
    Replies: 0
    Last Post: 04-27-2008, 08:49 AM
  2. adding a function to a program
    By trippedwire in forum C++ Programming
    Replies: 9
    Last Post: 09-30-2004, 01:35 PM
  3. Change the icon.
    By eletron in forum Windows Programming
    Replies: 2
    Last Post: 09-20-2004, 08:10 AM
  4. Replies: 2
    Last Post: 10-08-2002, 10:31 AM
  5. Replies: 2
    Last Post: 09-04-2001, 03:12 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21