Click here to Skip to main content
15,881,424 members
Articles / Desktop Programming / Win32

Adding an icon file's icons to an executable

Rate me:
Please Sign up or sign in to vote.
1.33/5 (2 votes)
24 Jul 2008CPOL1 min read 15.5K   175   12   1
A VS2008 C++ project to add an icon resource in a file to an executable.

Introduction

This VS2008 C++ project uses the STL and the Boost 1.35.0 library to produce a simple command line utility that takes the arguments of an icon file name, an executable file name, and optionally an integer in the range [1, 64K]. It then adds the icons in the icon file and adds them to the executable.

Background

This project came about as I had to add an icon resource to a product of a build which utilises the Qt qmake build system. As far as I could determine, this system does not allow for the required flexibility in assigning icon resources and versioning resources for a WinXP build. I initially solved my problem using batch files to parse rc files as a pre-link activity but after a post resource compilation. I decided that it was not very elegant and resolved to create a utility, to be used post-link, in my own time.

Information to achieve this simple goal is not very plentiful and what does exist is not concise.

Points of Interest

The C++ code uses STL file streams for getting the data out of the file and the boost::shared_array smart pointer for memory management.

Doxygen is used to provide the HTML documentation. Look for 'index.html' in the HTML bucket. It gives a nice way to explore the code.

I hope that this helps somebody!

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United Kingdom United Kingdom
My profession is Software Engineering.

I am qualified as an electrician and at one time was CORGI registered for domestic gas installations.

I have been a member of the British Computer Society (present grade CITP) and the ACCU since 1997.

Comments and Discussions

 
GeneralThanks Pin
splendided6-Nov-08 23:39
splendided6-Nov-08 23:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.