简体   繁体   中英

Win32 application not finding icon for window

I created a icon as a resource

解决方案资源管理器中的图标

I checked explorer and it works just fine, my exe now has that icon

Next, I used hIcon to set the icon of my window but it says that IDI_ICON1 is undefined在此处输入图像描述

Code:

wc.hIcon = LoadIcon (hInstance, MAKEINTRESOURCE(IDI_ICON1));

Is there any idea of why this is happening?

Symbolic constants for resource identifiers (such as IDI_ICON1 ) are usually stored in a separate header file called Resource.h by default. This allows both the resource script (.rc file) as well as source code to access the same symbols.

To use the constants in source code you need to introduce them through an #include directive. Otherwise the compiler is unable to find them, as the error messages indicates.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM