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. How to reduce exe size?

How to reduce exe size?

Scheduled Pinned Locked Moved C / C++ / MFC
c++adobetutorialquestionannouncement
12 Posts 8 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.
  • I includeh10

    My static linked MFC exe file is over 7M now, I think it shouldn't be so large. I have tried two ways to reduce its size:

    1. Change resource bmp files from 24 bits to 16 bits What software can do the change? As I tested, both PaintBrush and PhotoShop (version 6) can not do. How about CorelDraw? I have CorelDraw but didn't install.
    2. Exclude some lib files. I did nothing for this, because I don't know how to detect which lib is unused and how to disable it.

    Do you have any idea to reduce exe size with detail hints?

    _ Offline
    _ Offline
    _Superman_
    wrote on last edited by
    #2

    If you link statically to MFC, you're exe size is going to get bigger. You should have the option of using the shared version of MFC, if you want to really think about a small exe size. There are also other techniques of combining sections and using the proper compiler switches. Here are a few articles on reducing the size of the exe - http://msdn.microsoft.com/en-us/magazine/cc301696.aspx[^] http://www.catch22.net/tuts/minexe[^]

    «_Superman_» I love work. It gives me something to do between weekends.

    S 1 Reply Last reply
    0
    • _ _Superman_

      If you link statically to MFC, you're exe size is going to get bigger. You should have the option of using the shared version of MFC, if you want to really think about a small exe size. There are also other techniques of combining sections and using the proper compiler switches. Here are a few articles on reducing the size of the exe - http://msdn.microsoft.com/en-us/magazine/cc301696.aspx[^] http://www.catch22.net/tuts/minexe[^]

      «_Superman_» I love work. It gives me something to do between weekends.

      S Offline
      S Offline
      sunlin7
      wrote on last edited by
      #3

      the mspaint.exe can convert 24bit true color image to 16bit ones.

      CPalliniC 1 Reply Last reply
      0
      • I includeh10

        My static linked MFC exe file is over 7M now, I think it shouldn't be so large. I have tried two ways to reduce its size:

        1. Change resource bmp files from 24 bits to 16 bits What software can do the change? As I tested, both PaintBrush and PhotoShop (version 6) can not do. How about CorelDraw? I have CorelDraw but didn't install.
        2. Exclude some lib files. I did nothing for this, because I don't know how to detect which lib is unused and how to disable it.

        Do you have any idea to reduce exe size with detail hints?

        S Offline
        S Offline
        sunlin7
        wrote on last edited by
        #4

        try UPX to pack and compress your executeable files.

        I 1 Reply Last reply
        0
        • S sunlin7

          try UPX to pack and compress your executeable files.

          I Offline
          I Offline
          includeh10
          wrote on last edited by
          #5

          Member 4470227, I don't know software you mentioned. Is mspaint.exe PaintBrush or Paint program of Windows default tool? Or how to get them for free?

          L I 2 Replies Last reply
          0
          • I includeh10

            Member 4470227, I don't know software you mentioned. Is mspaint.exe PaintBrush or Paint program of Windows default tool? Or how to get them for free?

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #6

            Don't you mean UPX[^]?

            1 Reply Last reply
            0
            • I includeh10

              Member 4470227, I don't know software you mentioned. Is mspaint.exe PaintBrush or Paint program of Windows default tool? Or how to get them for free?

              I Offline
              I Offline
              Iain Clarke Warrior Programmer
              wrote on last edited by
              #7

              The paint program is pbrush.exe, and has been part of the OS install since Windows 3, if not before. It's got better as the years go on though! Iain.

              I have now moved to Sweden for love (awwww). If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need cotract work done, give me a job! http://cv.imcsoft.co.uk/[^]

              1 Reply Last reply
              0
              • I includeh10

                My static linked MFC exe file is over 7M now, I think it shouldn't be so large. I have tried two ways to reduce its size:

                1. Change resource bmp files from 24 bits to 16 bits What software can do the change? As I tested, both PaintBrush and PhotoShop (version 6) can not do. How about CorelDraw? I have CorelDraw but didn't install.
                2. Exclude some lib files. I did nothing for this, because I don't know how to detect which lib is unused and how to disable it.

                Do you have any idea to reduce exe size with detail hints?

                L Offline
                L Offline
                Luc Pattyn
                wrote on last edited by
                #8

                couldn't you use JPEG instead of BMP images? depending on size and complexity JPEG tends to compress images by a factor of 3 to 10 to 30. :)

                Luc Pattyn


                Local announcement (Antwerp region): Lange Wapper? Neen!


                1 Reply Last reply
                0
                • I includeh10

                  My static linked MFC exe file is over 7M now, I think it shouldn't be so large. I have tried two ways to reduce its size:

                  1. Change resource bmp files from 24 bits to 16 bits What software can do the change? As I tested, both PaintBrush and PhotoShop (version 6) can not do. How about CorelDraw? I have CorelDraw but didn't install.
                  2. Exclude some lib files. I did nothing for this, because I don't know how to detect which lib is unused and how to disable it.

                  Do you have any idea to reduce exe size with detail hints?

                  J Offline
                  J Offline
                  Joe Woodbury
                  wrote on last edited by
                  #9

                  With Visual Studio 2005, under Linker Optimization, make sure you are eliminating unreferenced data, enable COMDAT folding and set Optimize for Windows98 to No. Check if you are overusing templates. They tend to chew up a lot of space. You could also turn off intrinsic functions. Under code generation, turn off "Buffer Security Check" (some will disagree, if you read up on it, you'll find it's nearly useless, but does use space.) Under Language, i always turn of Run-Time Type Info (savings is small, but I never use it so why not?) Reexamine everything you are linking to; sometimes you use a tiny function that pulls in a huge amount of code even though you don't really need it. If your resource bitmaps are big, consider PNG or JPG.

                  1 Reply Last reply
                  0
                  • S sunlin7

                    the mspaint.exe can convert 24bit true color image to 16bit ones.

                    CPalliniC Offline
                    CPalliniC Offline
                    CPallini
                    wrote on last edited by
                    #10

                    Member 4470227 wrote:

                    the mspaint.exe can convert 24bit true color image to 16bit ones.

                    Paint sucks on decreasing color depth. Irfan View, for instance, is really better. :)

                    If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                    This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                    [My articles]

                    In testa che avete, signor di Ceprano?

                    1 Reply Last reply
                    0
                    • I includeh10

                      My static linked MFC exe file is over 7M now, I think it shouldn't be so large. I have tried two ways to reduce its size:

                      1. Change resource bmp files from 24 bits to 16 bits What software can do the change? As I tested, both PaintBrush and PhotoShop (version 6) can not do. How about CorelDraw? I have CorelDraw but didn't install.
                      2. Exclude some lib files. I did nothing for this, because I don't know how to detect which lib is unused and how to disable it.

                      Do you have any idea to reduce exe size with detail hints?

                      CPalliniC Offline
                      CPalliniC Offline
                      CPallini
                      wrote on last edited by
                      #11

                      includeh10 wrote:

                      Change resource bmp files from 24 bits to 16 bits What software can do the change? As I tested, both PaintBrush and PhotoShop (version 6) can not do. How about CorelDraw? I have CorelDraw but didn't install.

                      Decreasing the color depth may do the trick, provided you have many big images. Anyway this doesn't affect the executable's size when it is loaded in memory, I guess (unless you dynamically load, and then discard, images). IrfanView [^] a freeware image viewer, is very good in decreasing image color depth. :)

                      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                      [My articles]

                      In testa che avete, signor di Ceprano?

                      I 1 Reply Last reply
                      0
                      • CPalliniC CPallini

                        includeh10 wrote:

                        Change resource bmp files from 24 bits to 16 bits What software can do the change? As I tested, both PaintBrush and PhotoShop (version 6) can not do. How about CorelDraw? I have CorelDraw but didn't install.

                        Decreasing the color depth may do the trick, provided you have many big images. Anyway this doesn't affect the executable's size when it is loaded in memory, I guess (unless you dynamically load, and then discard, images). IrfanView [^] a freeware image viewer, is very good in decreasing image color depth. :)

                        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                        [My articles]

                        I Offline
                        I Offline
                        includeh10
                        wrote on last edited by
                        #12

                        Decreasing the color depth may do the trick, provided you have many big images. Anyway this doesn't affect the executable's size when it is loaded in memory, //----------------------------------- It does affect exe size, when I change bmp from 24 bits to 256 color, exe size becomes smaller.

                        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