Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Change Icon of exe

Change Icon of exe

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestionlearning
8 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Archer282
    wrote on last edited by
    #1

    Does anyone know of any articals or examples that show how to change the defualt icon of an exe? (if you say the words "resource editor" i will come to your house, chop your legs off, set your house on fire and watch as you drag your bloody stumps out door, nah im just keeding)

    T A R 3 Replies Last reply
    0
    • A Archer282

      Does anyone know of any articals or examples that show how to change the defualt icon of an exe? (if you say the words "resource editor" i will come to your house, chop your legs off, set your house on fire and watch as you drag your bloody stumps out door, nah im just keeding)

      T Offline
      T Offline
      the_augy
      wrote on last edited by
      #2

      Are you coding with MFC or not?

      A 1 Reply Last reply
      0
      • T the_augy

        Are you coding with MFC or not?

        A Offline
        A Offline
        Archer282
        wrote on last edited by
        #3

        well i would prefer that it not use mfc so i could use in other non-mfc projects too, but i will be using MFC to make that app yes,

        T 1 Reply Last reply
        0
        • A Archer282

          well i would prefer that it not use mfc so i could use in other non-mfc projects too, but i will be using MFC to make that app yes,

          T Offline
          T Offline
          the_augy
          wrote on last edited by
          #4

          Well, not using MFC, you can set your icon when you register your window class with WNDCLASSEX WNDCLASSEX wc; wc.hIcon = LoadIcon(HandleToYourInstance, "IDI_YOURAPPICON"); There are a couple other things in WNDCLASSEX that you can set to customize your program. In MFC, go to your CWnd class's constructor and initialize the m_hIcon member: m_hIcon = AfxGetApp()->LoadIcon(IDI_YOURAPPICON); Voila. augy

          A 1 Reply Last reply
          0
          • T the_augy

            Well, not using MFC, you can set your icon when you register your window class with WNDCLASSEX WNDCLASSEX wc; wc.hIcon = LoadIcon(HandleToYourInstance, "IDI_YOURAPPICON"); There are a couple other things in WNDCLASSEX that you can set to customize your program. In MFC, go to your CWnd class's constructor and initialize the m_hIcon member: m_hIcon = AfxGetApp()->LoadIcon(IDI_YOURAPPICON); Voila. augy

            A Offline
            A Offline
            Archer282
            wrote on last edited by
            #5

            Im sorry thats not what i was looking for that is how to change the icon of the window(which i already knew), I want to know how to progmatically change the default icon of an exe, the way a resource hacker would. and when i say the default icon of the exe im talking about the icon that would be showing up in explorer.

            T 1 Reply Last reply
            0
            • A Archer282

              Im sorry thats not what i was looking for that is how to change the icon of the window(which i already knew), I want to know how to progmatically change the default icon of an exe, the way a resource hacker would. and when i say the default icon of the exe im talking about the icon that would be showing up in explorer.

              T Offline
              T Offline
              the_augy
              wrote on last edited by
              #6

              oooooh. How does explorer decide what icon to display? It will automatically pull the main window's icon out and use that as the display icon, at least if it's compiled in MFC (or MFC is packaging the EXE with explorer information in it). Short answer: no f*ing idea. augy

              1 Reply Last reply
              0
              • A Archer282

                Does anyone know of any articals or examples that show how to change the defualt icon of an exe? (if you say the words "resource editor" i will come to your house, chop your legs off, set your house on fire and watch as you drag your bloody stumps out door, nah im just keeding)

                A Offline
                A Offline
                Arsalan Malik
                wrote on last edited by
                #7

                To change icon of an exe, you need to overwrite it's icon resource. But first you need to determine default icon, to do that you need programs like Resource Hacker. Once you have found ID of default icon, you can easily update resource. Just follow this article and MSDN.:cool: ARSALAN MALIK

                1 Reply Last reply
                0
                • A Archer282

                  Does anyone know of any articals or examples that show how to change the defualt icon of an exe? (if you say the words "resource editor" i will come to your house, chop your legs off, set your house on fire and watch as you drag your bloody stumps out door, nah im just keeding)

                  R Offline
                  R Offline
                  Ryan Binns
                  wrote on last edited by
                  #8

                  Archer282 wrote: Does anyone know of any articals or examples that show how to change the defualt icon of an exe? Well the "default" icon, the one shown by explorer, is always the first icon in the executable file. So all you have to do is edit the first icon. Is the icon in your executable? If so, use the resource editor. If it's in a separate executable, you'll need to use the BeginUpdateResource() etc. methods to access it at runtime.

                  Ryan

                  "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups