Icon Help

This is a discussion on Icon Help within the Windows Programming forums, part of the Platform Specific Boards category; Hello, I am trying to change the default icon that appears in the left side of the task bar. I ...

  1. #1
    VA National Guard The Brain's Avatar
    Join Date
    May 2004
    Location
    Manassas, VA USA
    Posts
    903

    Question Icon Help

    Hello,

    I am trying to change the default icon that appears in the left side of the task bar. I created a .ico file using a program called, "icon edit." I made all the proper annotations in resource.h and resource.rc; however, I still get the same old default icon in the taskbar. Any suggestions?

    I am using codeblocks 8.02 using with a known working program.

    resource.h excerpt
    Code:
    #define IDI_ICON 153
    rescource.rc excerpt
    Code:
    IDI_ICON ICON DISCARDABLE "C:\\Users\\Dsve\\Desktop\\Card Bitmaps\\ace icon.ico"
    call to load icon
    Code:
    wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON));

    This is a 32x32 icon. Program compiles without any errors. Complete code is available upon request. Please offer any suggestions if you see that I am missing something.
    Last edited by The Brain; 03-31-2009 at 01:41 AM.
    • "Problem Solving C++, The Object of Programming" -Walter Savitch
    • "Data Structures and Other Objects using C++" -Walter Savitch
    • "Assembly Language for Intel-Based Computers" -Kip Irvine
    • "Programming Windows, 5th edition" -Charles Petzold
    • "Visual C++ MFC Programming by Example" -John E. Swanke
    • "Network Programming Windows" -Jones/Ohlund
    • "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
    • "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel

  2. #2
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,263
    ...you mean the application icon (that appears next to the title of a top-level window in the taskbar)?

    For a moment there I thought you meant the Windows logo that is part of the Start button.

  3. #3
    Registered User
    Join Date
    Mar 2007
    Posts
    416
    I have mine defined as

    Code:
    IDD_ICON ICON "icon.ico" //in resource file
    
    SetClassLong(hwnd, GCL_HICON, (LONG) LoadIcon(hInstance, MAKEINTRESOURCE(IDD_ICON))); //in main.cpp file in WM_CREATE message
    This is also using codeblocks 8.02.

  4. #4
    Registered User
    Join Date
    Mar 2005
    Location
    Juneda
    Posts
    287
    In my DevC++ when occurs something like that I can solve always deleting the object and layout files, and recompiling it all. Is not an elegant method but it works for me. Hope that helps.

    Niara

  5. #5
    VA National Guard The Brain's Avatar
    Join Date
    May 2004
    Location
    Manassas, VA USA
    Posts
    903

    Exclamation

    tried all of ye' wonderful suggestions; however, am still unable to get a freaking icon to display in the left side of the running application's taskbar. Another case of good code that doesn't work unless I play the game of musical compilers and/or download some off the wall sdk or check some box in some setting somewhere in some unknown submenu.
    • "Problem Solving C++, The Object of Programming" -Walter Savitch
    • "Data Structures and Other Objects using C++" -Walter Savitch
    • "Assembly Language for Intel-Based Computers" -Kip Irvine
    • "Programming Windows, 5th edition" -Charles Petzold
    • "Visual C++ MFC Programming by Example" -John E. Swanke
    • "Network Programming Windows" -Jones/Ohlund
    • "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
    • "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel

  6. #6
    Registered User
    Join Date
    Mar 2007
    Posts
    416
    Another thought is that the icon file might not be saved correctly. I know when I downloaded some free icon editors some of them did not save it correctly causing it to not display.

  7. #7
    Registered User
    Join Date
    Mar 2005
    Location
    Juneda
    Posts
    287
    Take a look at the Icon Sizes recommendations (on the Win32 Prog Ref), it says:

    Code:
    Your application should supply icon resources in the following sizes:
     - 48x48, 256 color
     - 32x32, 16 color
     - 16x16 pixels, 16 color
    Maybe is possible that if the icon file 'ace icon.ico' does not accomplish that it will be showed in bad resolution, or at the worst case it won't be displayed.

    Hope that helps
    Niara

  8. #8
    VA National Guard The Brain's Avatar
    Join Date
    May 2004
    Location
    Manassas, VA USA
    Posts
    903

    Exclamation

    Thanks for your continued efforts on this somewhat frivilous task.. as you can see, I have a 32x32 16 color icon that for some mysterious reason will not show itself in me' program.

    I envision a day where code will work equally for everyone.
    Attached Images Attached Images  
    • "Problem Solving C++, The Object of Programming" -Walter Savitch
    • "Data Structures and Other Objects using C++" -Walter Savitch
    • "Assembly Language for Intel-Based Computers" -Kip Irvine
    • "Programming Windows, 5th edition" -Charles Petzold
    • "Visual C++ MFC Programming by Example" -John E. Swanke
    • "Network Programming Windows" -Jones/Ohlund
    • "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
    • "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel

  9. #9
    'Allo, 'Allo, Allo
    Join Date
    Apr 2008
    Posts
    611
    Have you filled in wc.hIconSm? If it's NULL (or you're not using a WNDCLASSEX) and wc.hIcon doesn't have a 16x16 icon in it, then you get the bog standard icon.

  10. #10
    Registered User
    Join Date
    Dec 2006
    Location
    Scranton, Pa
    Posts
    252
    Code:
        wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
        wincl.hIconSm = (HICON)LoadImage(GetModuleHandle(NULL),
        MAKEINTRESOURCE(IDI_SMLCON), IMAGE_ICON, 16, 16, 0);
    
    #define IDI_MYICON          010
    #define IDI_SMLCON          020
    
    IDI_SMLCON              ICON     DISCARDABLE     "Crazy.ICO"
    IDI_MYICON              ICON     DISCARDABLE     "Crazy.ICO"
    The above is all you need. If I stop on by tomorrow and you haven't gotten it, I'll pack up a small, working example.

  11. #11
    Registered User
    Join Date
    Dec 2006
    Location
    Scranton, Pa
    Posts
    252
    Here's the example code. This 'il change your titlebar icon and the running window (taskbar) icon.

    I'm assuming that this is what you're referring to -
    Last edited by Oldman47; 04-03-2009 at 09:47 PM.

  12. #12
    VA National Guard The Brain's Avatar
    Join Date
    May 2004
    Location
    Manassas, VA USA
    Posts
    903

    Thumbs up TY Oldman47

    it woiks..!! :^)
    Attached Images Attached Images  
    Last edited by The Brain; 04-05-2009 at 04:24 PM.
    • "Problem Solving C++, The Object of Programming" -Walter Savitch
    • "Data Structures and Other Objects using C++" -Walter Savitch
    • "Assembly Language for Intel-Based Computers" -Kip Irvine
    • "Programming Windows, 5th edition" -Charles Petzold
    • "Visual C++ MFC Programming by Example" -John E. Swanke
    • "Network Programming Windows" -Jones/Ohlund
    • "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
    • "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Custom Icon for DLL
    By Delf in forum Windows Programming
    Replies: 5
    Last Post: 06-10-2005, 08:36 AM
  2. icon not showing
    By xlnk in forum Windows Programming
    Replies: 2
    Last Post: 02-27-2004, 05:36 PM
  3. Icon problem
    By mkyong in forum Windows Programming
    Replies: 0
    Last Post: 02-17-2003, 04:39 PM
  4. Icon? help!
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 12-16-2001, 05:21 PM
  5. icon in title bar?
    By Unregistered in forum Windows Programming
    Replies: 3
    Last Post: 12-12-2001, 05:43 PM

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