添加info.rc文件内容如下
在.pro项目文件中,添加 RC_FILES += info.rc
IDI_ICON1 ICON DISCARDABLE"ico.ico"
#if defined(UNDER_CE)
#include <winbase.h>
#else
#include <winver.h>
#endif
VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,0,9
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", "广州爱你网络科技有限公司"
VALUE "FileDescription", "爱你音乐"
VALUE "InternalName", "Love You"
VALUE "LegalCopyright", "Copyright (C) 2019"
VALUE "OriginalFilename", "爱你"
VALUE "ProductName", "LoveYou"
VALUE "ProductVersion", "2.0.9"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x804, 1200
END
END
1 24 "UAC.manifest"
其中最后一句 1 24 "UAC.manifest"
是使用管理员权限运行程序。
UAC.manifest内容如下
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level='requireAdministrator' uiAccess='false' />
</requestedPrivileges>
</security>
</trustInfo>
</assembly>