效果图:
第一步:
创建一个.rc文件,如我再代码根目录下创建了一个myApp.rc文件和准备一张ICO图标
内容为:
IDI_ICON1 ICON DISCARDABLE "csdn.ico" #if defined(UNDER_CE) #include <winbase.h> #else #include <winver.h> #endif VS_VERSION_INFO VERSIONINFO FILEVERSION 1,0,0,0 PRODUCTVERSION 1,0,0,0 PRODUCTVERSION 1,0,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS VS_FF_DEBUG #else FILEFLAGS 0x0L #endif FILEOS VOS__WINDOWS32 FILETYPE VFT_DLL FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "080404b0" BEGIN VALUE "CompanyName", "XzpBlog Technology Co.Ltd.\0" VALUE "FileDescription", "CsdnDemo.exe\0" VALUE "FileVersion", "1.0.0.0\0" VALUE "ProductVersion", "1.0.0.0\0" VALUE "LegalCopyright", "Copyright (C)2010-2020\0" VALUE "LegalTrademarks", "XzpBlog Technology Co.Ltd.\0" VALUE "OriginalFilename", "CsdnDemo.exe\0" VALUE "ProductName", "CsdnDemo.exe\0" VALUE "InternalName", "CsdnDemo.exe\0" END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x804, 1200 END END
第二步:
在.pro文件中添加
RC_FILE = myApp.rc
重新编译就可以了
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/xzpblog/article/details/84371189