Changing the Icon on your exe...

This is a discussion on Changing the Icon on your exe... within the Windows Programming forums, part of the Platform Specific Boards category; How do I change the Icon on my exe?...

  1. #1
    Registered User Ranedhel's Avatar
    Join Date
    Jun 2003
    Posts
    34

    Changing the Icon on your exe...

    How do I change the Icon on my exe?
    -Elven Forge Software-
    (Lead Designer)

    http://www.geocities.com/elvenforge

    **infected by frenchfry164**
    I am a signature virus. Please add me to your signature so that I may multiply

  2. #2
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,493
    That's really more of a windows or tech board question.

  3. #3
    Registered User Ranedhel's Avatar
    Join Date
    Jun 2003
    Posts
    34
    hmmm...I guess it is...

    Sorry.
    -Elven Forge Software-
    (Lead Designer)

    http://www.geocities.com/elvenforge

    **infected by frenchfry164**
    I am a signature virus. Please add me to your signature so that I may multiply

  4. #4
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Moved to the Windows forum (guessing that's where you want it ? )
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  5. #5
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Are you using visual studio? If so, just make an icon resource and when you register your class you can load it there. Look up MAKEINTRESOURCE
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  6. #6
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768
    I think he's talking about changing the icon by command, after the program has been compiled... like some of the trojans.
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

  7. #7
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    Are you making some subtle hint Devil Panther?

    like some of the trojans
    Let's not jump to conclusions.

    As for changing the icon during runtime, that should be possible somehow. A dodgy method of using WM_NCPAINT springs to mind. Of course, that's not REALLY changing the icon, just painting where it would be. And it would only paint one of the many application icons on the screen. Bah. Someone else?
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  8. #8
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768
    hell no!

    It's just really cool how some trojans can change their icon. But how do they do it... that's a mystery.
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

  9. #9
    Registered User Ranedhel's Avatar
    Join Date
    Jun 2003
    Posts
    34

    Unhappy Re:

    No Ideas? Drat.
    -Elven Forge Software-
    (Lead Designer)

    http://www.geocities.com/elvenforge

    **infected by frenchfry164**
    I am a signature virus. Please add me to your signature so that I may multiply

  10. #10
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Set the icon when you register the window class (see RegisterClassEx) or you can do it at runtime (eg for dialogs where you haven't registered a window class) with WM_SETICON (use SendMessage) or by using SetClassLong/SetClassLongPtr (GCL_HICON or GCL_HICONSM index). Search this board as this has been asked a number of times.

  11. #11
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    Yep, WM_SETICON works.

    Code:
    HICON hIcon;
    hIcon=LoadIcon(NULL,IDI_HAND);
    SendMessage(hwnd,WM_SETICON,(WPARAM)ICON_SMALL,(LPARAM)hIcon);
    SendMessage(hwnd,WM_SETICON,(WPARAM)ICON_BIG,(LPARAM)hIcon);
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  12. #12
    Registered User Ranedhel's Avatar
    Join Date
    Jun 2003
    Posts
    34

    Re:

    Ah, thanks. But I just found a way to do it with my compiler....
    -Elven Forge Software-
    (Lead Designer)

    http://www.geocities.com/elvenforge

    **infected by frenchfry164**
    I am a signature virus. Please add me to your signature so that I may multiply

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Changing icon for Borland C++ apps
    By spank in forum Windows Programming
    Replies: 0
    Last Post: 07-21-2006, 07:10 AM
  2. Free Exe Icon Changer?
    By Grantyt3 in forum Tech Board
    Replies: 4
    Last Post: 01-29-2006, 04:32 PM
  3. Dynamically changing an icon
    By face_master in forum Windows Programming
    Replies: 3
    Last Post: 10-14-2002, 08:50 AM
  4. Icon for exe
    By Ward in forum Windows Programming
    Replies: 7
    Last Post: 09-17-2001, 02:53 AM

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