WIN32 How to add icons to application programs

Source: Internet
Author: User

You need to change the icon of an EXE after the WIN32 application project runs as follows:

Since the WIN32 application project started without resources, many people do not know how to import an ICO icon in the following ways

1, in the menu bar to occupy the Insert-"resource such as:


Then click Save, select the path you want to save (the path where the program is located)

Then you will be sent two files under that path that exist script1.rc and resource.h.

2, add script1.rc and resource.h two files to the project. Shouldn't this be a detail?

Then add in the program

#include "resource.h" header file//This depends on the location of your resource file

Then add the code in the program:

WNDCLASS WC;
Wc.hicon = LoadIcon (hinstance, (LPCTSTR) idi_icon1); Idi_icon1 the ID of the icon to add

You can look at the results here.

Hope you succeed!!



WIN32 How to add icons to application programs

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.