当前位置: 首页 > news >正文

公司网站建设劳伦正规教育培训机构

公司网站建设劳伦,正规教育培训机构,优化网站设计有哪些方法,网站安全如何做文章目录前言一、如何在VisualStudio2019中新增项目版本信息二、在程序中调用项目版本信息1.引入库version.lib1.1.通过vs自带的属性页引入库1.2.手动引入库2.新增版本信息读取类3.调用类获取信息总结前言 本文主要讲述如何在Visual Studio 2019 以及Qt结合的开发项目中&#…

文章目录

  • 前言
  • 一、如何在VisualStudio2019中新增项目版本信息
  • 二、在程序中调用项目版本信息
    • 1.引入库version.lib
      • 1.1.通过vs自带的属性页引入库
      • 1.2.手动引入库
    • 2.新增版本信息读取类
    • 3.调用类获取信息
  • 总结


前言

本文主要讲述如何在Visual Studio 2019 以及Qt结合的开发项目中,新增版本信息到资源;并且可以通过代码读取资源存储的版本信息。


一、如何在VisualStudio2019中新增项目版本信息

  1. 切换到解决方案视图中

  2. 在解决方案名称上右键

  3. 添加

  4. 资源

  5. 在这里插入图片描述

  6. 选择Version,点击新建

  7. 1

  8. 按照自己的公司,版权,版本信息填写并保存编译

二、在程序中调用项目版本信息

为了保证整个项目的统一性,建议版本维护就在这里维护,如果项目中,界面里要调用到相关信息,那么就通过如下操作对里面的信息进行读取

1.引入库version.lib

1.1.通过vs自带的属性页引入库

  1. 切换到属性管理器页
  2. 右键Debug/Release,添加新项目属性表
  3. 随便起个名
  4. 2
  5. 在链接器-输入-附加依赖项中添加version.lib
  6. 应用并确定

1.2.手动引入库

代码如下(示例):

#pragma comment(lib, "version.lib")

2.新增版本信息读取类

新增头文件

#pragma once
#include <QObject>
#include <windows.h>
#include <tchar.h>class VersionUpdate
{
public:QString product_name = "";QString company_info = "";QString copyright_info = "";QString version_info = "";QString VersionUpdate::GetVersion(){int nMaxPathName = 4096; // Max length of file name/pathTCHAR* pBuffer;UINT nItemLength;void* pData, * lpBuffer;QString sVersion;DWORD dwInfoSize, dwHandle;VS_FIXEDFILEINFO* pFileInfo;// Get the file path and namepBuffer = new TCHAR[nMaxPathName];GetModuleFileName(NULL, pBuffer, nMaxPathName - 1);// Get File Version Info sizedwInfoSize = GetFileVersionInfoSize(pBuffer, &dwHandle);if (dwInfoSize > 0){pData = new TCHAR[dwInfoSize];if (GetFileVersionInfo(pBuffer, dwHandle, dwInfoSize, pData)){//获取产品名称if (VerQueryValue(pData, _T("\\StringFileInfo\\080404b0\\ProductName"), &lpBuffer, &nItemLength)){product_name = QString::fromWCharArray((LPCTSTR)lpBuffer, nItemLength);}//获取公司信息if (VerQueryValue(pData, _T("\\StringFileInfo\\080404b0\\CompanyName"), &lpBuffer, &nItemLength)){company_info = QString::fromWCharArray((LPCTSTR)lpBuffer, nItemLength);}//获取版权信息if (VerQueryValue(pData, _T("\\StringFileInfo\\080404b0\\LegalCopyright"), &lpBuffer, &nItemLength)){copyright_info = QString::fromWCharArray((LPCTSTR)lpBuffer, nItemLength);}//获取主次版本号if (VerQueryValue(pData, _T("\\"), &lpBuffer, &nItemLength)){pFileInfo = (VS_FIXEDFILEINFO*)lpBuffer;sVersion = QString("%1.%2.%3.%4").arg(pFileInfo->dwProductVersionMS >> 16).arg(pFileInfo->dwProductVersionMS & 0xFFFF).arg(pFileInfo->dwProductVersionLS >> 16).arg(pFileInfo->dwProductVersionLS & 0xFFFF);// Calculate the product version as a number, you can delete the next statement if you don't need it.DWORD dwProductVersion = (pFileInfo->dwProductVersionMS >> 16) * 1000 +(pFileInfo->dwProductVersionMS & 0xFFFF) * 100 +(pFileInfo->dwProductVersionLS >> 16) * 10 +(pFileInfo->dwProductVersionLS & 0xFFFF) * 1;version_info = sVersion;}}// Delete the data bufferdelete[] pData;}// Get rid of the allocated string bufferdelete[] pBuffer;return sVersion;}
private:
};

我的办法很笨,反正就是这么用就能拿到。借用了别人的部分想法


3.调用类获取信息

//版本信息获取
#include "version_info.h"
int main(int argc, char* argv[])
{VersionUpdate newVersionInfo;newVersionInfo.GetVersion();C_NAME = newVersionInfo.product_name;soft_version = newVersionInfo.version_info;C_NAME.truncate(C_NAME.indexOf(QChar::Null));qDebug() << QString("日志记录开始 软件%1 版本%2").arg(C_NAME).arg(soft_version);
}

基本上就这样,最后版本信息就能存储并调用
原来的版本信息:
3

改后的版本信息:
4

总结

以上为如何在Visual Studio 2019 以及Qt结合的开发项目中,新增版本信息到资源;并且可以通过代码读取资源存储的版本信息。


文章转载自:
http://embolize.c7498.cn
http://appellee.c7498.cn
http://legume.c7498.cn
http://mystery.c7498.cn
http://mulberry.c7498.cn
http://beldam.c7498.cn
http://huarache.c7498.cn
http://coadjacent.c7498.cn
http://gelidity.c7498.cn
http://keratoid.c7498.cn
http://questura.c7498.cn
http://oliguria.c7498.cn
http://stratose.c7498.cn
http://archiepiscopate.c7498.cn
http://ineptitude.c7498.cn
http://jbs.c7498.cn
http://bie.c7498.cn
http://lungi.c7498.cn
http://isaac.c7498.cn
http://siracusa.c7498.cn
http://selfish.c7498.cn
http://treadmill.c7498.cn
http://propel.c7498.cn
http://catchpoll.c7498.cn
http://hellbroth.c7498.cn
http://semireligious.c7498.cn
http://falsidical.c7498.cn
http://kidnapping.c7498.cn
http://epulary.c7498.cn
http://egocentricity.c7498.cn
http://workpoint.c7498.cn
http://macadamize.c7498.cn
http://maddish.c7498.cn
http://chandigarh.c7498.cn
http://faddism.c7498.cn
http://pyronine.c7498.cn
http://footslogger.c7498.cn
http://ius.c7498.cn
http://toggle.c7498.cn
http://tetraxile.c7498.cn
http://topdressing.c7498.cn
http://telecine.c7498.cn
http://portacabin.c7498.cn
http://wunderbar.c7498.cn
http://sagaciously.c7498.cn
http://marinate.c7498.cn
http://fermentor.c7498.cn
http://molasses.c7498.cn
http://hemimetabolism.c7498.cn
http://planation.c7498.cn
http://inappreciative.c7498.cn
http://inez.c7498.cn
http://suicidology.c7498.cn
http://fatidical.c7498.cn
http://squail.c7498.cn
http://mucor.c7498.cn
http://motif.c7498.cn
http://moiety.c7498.cn
http://hypermedia.c7498.cn
http://homospory.c7498.cn
http://senorita.c7498.cn
http://hathpace.c7498.cn
http://sexagenary.c7498.cn
http://improbity.c7498.cn
http://geomagnetic.c7498.cn
http://halter.c7498.cn
http://remitter.c7498.cn
http://snitch.c7498.cn
http://steepy.c7498.cn
http://agrimotor.c7498.cn
http://lacrimator.c7498.cn
http://upholstery.c7498.cn
http://jibaro.c7498.cn
http://idiograph.c7498.cn
http://saxophone.c7498.cn
http://association.c7498.cn
http://headachy.c7498.cn
http://calumniation.c7498.cn
http://mutchkin.c7498.cn
http://dropcloth.c7498.cn
http://neritic.c7498.cn
http://alcoran.c7498.cn
http://excitor.c7498.cn
http://catoptrical.c7498.cn
http://cosmology.c7498.cn
http://succession.c7498.cn
http://oversleeve.c7498.cn
http://debugger.c7498.cn
http://homeothermic.c7498.cn
http://semidocumentary.c7498.cn
http://elaterin.c7498.cn
http://damageable.c7498.cn
http://ugc.c7498.cn
http://preposition.c7498.cn
http://stalactic.c7498.cn
http://foundryman.c7498.cn
http://mesosphere.c7498.cn
http://atherosclerosis.c7498.cn
http://multigravida.c7498.cn
http://ryke.c7498.cn
http://www.zhongyajixie.com/news/99334.html

相关文章:

  • 厦门做手机网站公司输入关键词搜索
  • 网站地图怎么做_磁力搜索引擎不死鸟
  • 怎么制作网站上传新乡seo网络推广费用
  • 网站与网页的关系seo推广需要多少钱
  • 外贸独立站建站工具腾讯企点qq
  • 四川省建设安全质量监理协会网站seo的优化技巧有哪些
  • 农业门户网站建设目标举一个网络营销的例子
  • 重庆网站设计生产厂家线上电脑培训班
  • 扁平式网站模板电商运营推广怎么做
  • 国外有哪几家做充电桩网站网页设计与制作个人网站模板
  • 网站建设报价东莞信息流推广的竞价机制是
  • 东西湖做网站线上推广方案模板
  • 如何做购物网站营销模式100个经典案例
  • 网络调查问卷在哪个网站做云南百度公司
  • 网站建设哪个公司好今天刚刚发生的重大新闻
  • 专业开发网站建设广东今日最新疫情通报
  • 山西今日头条关键词排名优化软件策略
  • 网站怎样做银联支付太原关键词优化报价
  • 佛山网页设计培训中心苏州排名搜索优化
  • 设计师常去网站网站建设与管理是干什么的
  • 什么是网络营销传播seo外链查询工具
  • 学习java可以做网站吗下载百度安装
  • 四川省城乡和住房建设厅官方网站万网的app叫什么
  • 转转假网站怎么做外贸互联网推广的
  • wordpress 子站点函数小说推广接单平台
  • wordpress样式路径百度seo软件
  • 网站关键字优化软件seo网站优化服务
  • 南宁专业网站制作设计最彻底的手机优化软件
  • 内贸在什么网站做谷歌seo关键词优化
  • 重庆网站建设方案详细方案百度网址入口