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#
  4. Embedding a second icon into an exe file...

Embedding a second icon into an exe file...

Scheduled Pinned Locked Moved C#
questionhardware
8 Posts 2 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.
  • S Offline
    S Offline
    Shy Agam
    wrote on last edited by
    #1

    Hello experts, I'm applying some finishing touches to one of my applications. The exe's icon was selected via the project's properties, on the "Application" section, where it says "Icon:". Now, if I would create a shortcut to some file, and attempt to change its icon, pointing the icon selection dialog to my exe, the dialog would display the program's icon. Same goes for any other icon sucking program... I'm guessing that the program's icon is embedded in a specific section of the exe, which later gets scanned by the icon selection dialog. How can I embed icons to the exe so they would also be in the same section? Thanks in advance, Shy.

    E 1 Reply Last reply
    0
    • S Shy Agam

      Hello experts, I'm applying some finishing touches to one of my applications. The exe's icon was selected via the project's properties, on the "Application" section, where it says "Icon:". Now, if I would create a shortcut to some file, and attempt to change its icon, pointing the icon selection dialog to my exe, the dialog would display the program's icon. Same goes for any other icon sucking program... I'm guessing that the program's icon is embedded in a specific section of the exe, which later gets scanned by the icon selection dialog. How can I embed icons to the exe so they would also be in the same section? Thanks in advance, Shy.

      E Offline
      E Offline
      Ed Poore
      wrote on last edited by
      #2

      Take a look at the last entry in this[^] discussion.


      My Blog[^]

      S 1 Reply Last reply
      0
      • E Ed Poore

        Take a look at the last entry in this[^] discussion.


        My Blog[^]

        S Offline
        S Offline
        Shy Agam
        wrote on last edited by
        #3

        Thanks, but it did not work for me... However, I've found my own solution. After compiling the exe file, you open it in VS, either by selecting it via File > Open > File, or by clicking the small "Show all files" icon on the top of the solution explorer, navigating (still in the solution explorer) to the exe file, and double clicking it. In the new opened tab it is possible to import the icon into the already compiled exe. :-D Of course it has to be done EVERY TIME the exe is recompiled, which is quite annoying... :doh: So I'm thinking of learning how to use Post-Build Events... Maybe I could make VS import the icon automatically every time... Well... I hope this post will help others achieve the same goal. I intend to write a small article about this, and maybe combine it with another subject. Hope I'll have the time... :) Regards, Shy.

        E 1 Reply Last reply
        0
        • S Shy Agam

          Thanks, but it did not work for me... However, I've found my own solution. After compiling the exe file, you open it in VS, either by selecting it via File > Open > File, or by clicking the small "Show all files" icon on the top of the solution explorer, navigating (still in the solution explorer) to the exe file, and double clicking it. In the new opened tab it is possible to import the icon into the already compiled exe. :-D Of course it has to be done EVERY TIME the exe is recompiled, which is quite annoying... :doh: So I'm thinking of learning how to use Post-Build Events... Maybe I could make VS import the icon automatically every time... Well... I hope this post will help others achieve the same goal. I intend to write a small article about this, and maybe combine it with another subject. Hope I'll have the time... :) Regards, Shy.

          E Offline
          E Offline
          Ed Poore
          wrote on last edited by
          #4

          Ok I've found out how to do it :jig:

          1. File | New
          2. Select Native Resource Template
          3. Import icons etc you want
          4. File | Save As (make sure 32-bit resource (*.res) is selected in the File Type combo)
          5. Save the file somewhere
          6. Open up the properties pages of your Project, change the radio button by the Application icon to Resource File
          7. Browse & select the resource file.
          8. Voila!

          This should probably be put into an article at some point since there's no where sensible where this is explained (that I came across)...  If I've got time over the weekend I'll do it, unless you want to?


          My Blog[^]

          S 1 Reply Last reply
          0
          • E Ed Poore

            Ok I've found out how to do it :jig:

            1. File | New
            2. Select Native Resource Template
            3. Import icons etc you want
            4. File | Save As (make sure 32-bit resource (*.res) is selected in the File Type combo)
            5. Save the file somewhere
            6. Open up the properties pages of your Project, change the radio button by the Application icon to Resource File
            7. Browse & select the resource file.
            8. Voila!

            This should probably be put into an article at some point since there's no where sensible where this is explained (that I came across)...  If I've got time over the weekend I'll do it, unless you want to?


            My Blog[^]

            S Offline
            S Offline
            Shy Agam
            wrote on last edited by
            #5

            Works perfect! Hehe... I would have never thought of sniffing through the Visual C++ node in the "New File" dialog... ;) That's a lot better than modifying the exe every time you compile it! :-D

            Ed.Poore wrote:

            If I've got time over the weekend I'll do it, unless you want to?

            Go ahead and write the article... :) I'll probably won't find (or should I say take...? ;P) the time to do it myself anyway... Thanks a bunch! Shy.

            E 1 Reply Last reply
            0
            • S Shy Agam

              Works perfect! Hehe... I would have never thought of sniffing through the Visual C++ node in the "New File" dialog... ;) That's a lot better than modifying the exe every time you compile it! :-D

              Ed.Poore wrote:

              If I've got time over the weekend I'll do it, unless you want to?

              Go ahead and write the article... :) I'll probably won't find (or should I say take...? ;P) the time to do it myself anyway... Thanks a bunch! Shy.

              E Offline
              E Offline
              Ed Poore
              wrote on last edited by
              #6

              shyagam wrote:

              Go ahead and write the article...

              Done (needed something to make me fall asleep :rolleyes:).


              My Blog[^]

              S 1 Reply Last reply
              0
              • E Ed Poore

                shyagam wrote:

                Go ahead and write the article...

                Done (needed something to make me fall asleep :rolleyes:).


                My Blog[^]

                S Offline
                S Offline
                Shy Agam
                wrote on last edited by
                #7

                Hehe... Cool! You even got the screen shots and all... :) Voted 5 for the article of course! ;) Well... I guess that now, after solving the problem, I can start coding again and compensate for all of the day time I've lost. Another sleepless night... :laugh: Regards, Shy.

                E 1 Reply Last reply
                0
                • S Shy Agam

                  Hehe... Cool! You even got the screen shots and all... :) Voted 5 for the article of course! ;) Well... I guess that now, after solving the problem, I can start coding again and compensate for all of the day time I've lost. Another sleepless night... :laugh: Regards, Shy.

                  E Offline
                  E Offline
                  Ed Poore
                  wrote on last edited by
                  #8

                  shyagam wrote:

                  Voted 5 for the article of course! ;)

                  Thank you :-O

                  shyagam wrote:

                  You even got the screen shots and all... :)

                  Well I had to pad out the article... :rolleyes:


                  My Blog[^]

                  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