获取windows系统版本号 [GetVersionEx]

inno5 Setup功能函数合集 function CheckWin7(): Boolean; begin GetWindowsVersionEx(Version); if Version.Major = 6 then begin Result := True; end else begin Result := False; end; end; 立即下载

获取windows系统版本号 [GetVersionEx]

#include <windows.h>
#include <tchar.h>
#include <strsafe.h>
#include <iostream>
using namespace std;

int _tmain(int argc,TCHAR * argv[])
{
OSVERSIONINFOEX osVersionInfoEx;

//ZeroMemory(&osVersionInfoEx,sizeof(osVersionInfoEx));
osVersionInfoEx.dwOSVersionInfoSize=sizeof(osVersionInfoEx); //注意空间,这句会申请一个存放结构体信息的空间,如果没有这句,结果当然没有.

if(! GetVersionEx((LPOSVERSIONINFO)&osVersionInfoEx))
   cerr<<"GetVersionEx(LPOSVERSIONINFO osVersionInfoEx) return FALSE"<<endl;
else
{
   cout<<osVersionInfoEx.dwOSVersionInfoSize<<endl; //结构体size
   cout<<osVersionInfoEx.dwMajorVersion<<endl; //主版本
   cout<<osVersionInfoEx.dwMinorVersion<<endl; //次版本
   cout<<osVersionInfoEx.dwBuildNumber<<endl; //当前系统的构建版本号
   cout<<osVersionInfoEx.dwPlatformId<<endl; //当前系统平台(支持的套件)

   cout<<osVersionInfoEx.szCSDVersion<<endl;
   cout<<osVersionInfoEx.wServicePackMajor<<endl; //SP(x)
   cout<<osVersionInfoEx.wServicePackMinor<<endl; //SP(x)
   cout<<osVersionInfoEx.wSuiteMask<<endl;
   //cout<<osVersionInfoEx.wProductType<<endl;
   //cout<<osVersionInfoEx.wReserved<<endl;

   cout<<"Your system is : ";

   switch(osVersionInfoEx.dwPlatformId)
   {
   case VER_PLATFORM_WIN32_NT:
    if(osVersionInfoEx.dwMajorVersion==6 && osVersionInfoEx.dwMinorVersion==0)
     cout<<"Windows Vista"<<endl;
    else if(osVersionInfoEx.dwMajorVersion==5 && osVersionInfoEx.dwMinorVersion==0)
     cout<<"Windows 2000"<<endl;
    else if(osVersionInfoEx.dwMajorVersion==5 && osVersionInfoEx.dwMinorVersion==1)
     cout<<"Windows XP"<<endl;
    else if(osVersionInfoEx.dwMajorVersion==4 && osVersionInfoEx.dwMinorVersion==0)
     cout<<"Windows NT"<<endl;
    break;
   case VER_PLATFORM_WIN32_WINDOWS:
    if(osVersionInfoEx.dwMajorVersion==4 && osVersionInfoEx.dwMinorVersion==10)
     cout<<"Windows 98"<<endl;
    else if(osVersionInfoEx.dwMajorVersion==4 && osVersionInfoEx.dwMinorVersion==90)
     cout<<"Windows ME"<<endl;
    else
     cout<<"Windows 95"<<endl;
    break;
   default:
    break;
   }
}
return 0;
}

 

获取Windows系统的版本信息 立即下载

相关推荐

ESP32蓝牙广播数据自定义指南:让你的设备更容易被手机发现

本文详细介绍了如何通过自定义ESP32蓝牙广播数据提升设备在手机端的可发现性。从广播数据结构、扫描响应优化到跨平台兼容性设置,提供了全面的技术指南和实战代码示例,帮助开发者解决智能硬件开发中的蓝牙连接难题。

weixin_29172201的博客 275

获取Windows系统版本

语言:C/C++ 编程软件:VS2015 字符集:UNICODE编码 【1】说明 1、由于GetVersionEx函数在Windows 8.1版本之后,返回的结果全部是6.2,这函数被微软动了手脚的,但是实际上可以利用额外添加一个manifest文件指示兼容新版本. (参看文章:http://blog.csdn.net/k1988/article/details/47614529) ...

Aaron的博客 8982

Oracle Patch清理

- opatch clean的帮助,该命令清除.patch_storage directory文件夹下的'restore.sh,make.txt' files and 'scratch,backup'-- 执行完毕后,貌似没有变化,可能和自己环境有关(19年开始测试补丁,基本上每个季度都测试,后面把又把数据库用RMAN做了迁移,又转换成了PDB模式)。在对Oracle安装补丁后,会发现OS上被占用了大量的空间,本文档清理Opatch过程中的一些文件,释放空间。--清理后空间,剩余25G。

文档搬运工 1075

Windows API 函数GetVersionEx 获取系统版本出错

Windows API 函数GetVersionEx 获取系统版本出错 win7下得到操作系统版本错误( GetVersionEx) 有一段得到操作系统版本的代码,用的是 GetVersionEx 方法,在当前机器的硬盘上运行,得到的操作系统版本是win7。奇怪的是,在U盘上运行,得到的操作系统版本是XP。 直接说原因:   不知道什么时候,系统在注册表中设置了U盘exe的

sifan的专栏 1135

清理异常值(MAD:绝对中位差)

清理异常数据: 中位数绝对偏差(MAD):用来描述单变量样本在定量数据中可变的一种标准 在统计学中,绝对中位差是刻画一元数据样本变化的一个鲁棒度量。由公式可以看出,其求解还算简单,给定一个数据样本集,首先求其中位数,然后求原始数据减去中位数的绝对值从而形成一个新的数据样本,再求新的数据样本的中位数即为绝对中位差。比如说有一个数据样本集X={2 3 8 7 9 6 4},这时候数据的中位数是6,原...

spider_man 1万+

绝缘检测原理和绝缘电阻计算方法

绝缘检测的目的就是计算绝缘电阻,当绝缘电阻低于某个阈值,则很可能会造成电池短路、漏电,威胁人员安全

m0_56208280的博客 4万+

GetVersionEx 获取系统版本

GetVersionExA function may be altered or unavailable for releases after Windows 8.1. Instead, use the Version Helper functions. For Windows 10 apps, please see Targeting your applications for Windows.

zing's blog 745

URScript介绍

优傲机器人(Universal Robots)是丹麦工业协作机器人制造商,2005年成立,2015年被泰瑞达收购。其自研编程语言URScript基于Python语法,专为机器人控制优化,支持运动指令、IO控制等功能,具有类Python的简洁语法和实时性特点。URScript提供丰富的API,支持变量赋值、条件判断、循环及函数定义等编程结构,参数按值传递。用户可通过该语言在Polyscope界面编写程序,实现自动化任务。目前优傲在全球20多个办事处为多国客户提供服务。

谢谢大家的关注和点赞!这里只有纯纯的知识干货,没有一句废话。希望能实实在在帮到大家~要是觉得有用,别忘了给我点支持哟,你 608

C/C++判断操作系统(Win10,Win8.1WinServer等等)-完整源码及思路

C/C++判断电脑系统(Win10,Win8.1WinServer等等)

IT1995的博客 3万+

【信创-k8s】银河麒麟V10国防版+鲲鹏/飞腾(arm64架构)在线/离线部署k8s1.30+kubesphere

银河麒麟作为国家核高基专项的重要成果,国防版凭借其卓越的安全性和可靠性,已成为军工领域的首选操作系统。之前我们在适配麒麟V4国防版的过程中已发现诸多安全性要求,而麒麟V10国防版在安全防护等级上又达到了更高的级别。本文将主要演示离线部署,因为军工项目基本不会出现联网场景。即使在线,也可以按离线方式部署,且离线部署由于有私有仓库,不会存在镜像获取不到和丢失情况。

2023年最新地推相关信息 552

第67步 时间序列建模实战:ARIMA建模(Stata)

第67步 时间序列建模实战:ARIMA建模(Stata)

Jet4505的博客 6829

GetVersionEx 获取较新Windows系统版本

<br /><br />本文转自:http://hi.baidu.com/letwin/blog/item/1750f2124e0471c4c2fd7827.html获得Windows版本GetVersion(Windows XP、Windows Vista、Windows 7、Windows 2000、Windows Server 20032009-11-16 10:21<br /> <br />写程序需要查看Windows的版本号来决定程序如何操作,看到MSDN的GetVersion 函数,这个函数返回

1800

ASPICE学习笔记

ASPICE的全称是Automotive SPICE。

汽车电子软件领域知识分享 1357

获取版本号_实战经验:在Windows 8.1/10上获取具体的系统版本号

问题碰到这样一个问题,需要获取当前运行系统的版本号。对于Windows系统来说,主要需要关注的是两个版本号:主版本,次版本。例如:Windows 7系统的版本号为:6.1。Windows 10的版本号为:10.0。过去我们可以使用Windows API GetVersionEx来获取系统版本,但是从Windows8.1开始,如果程序没有进行Manifest(原谅我也不知道怎么翻译这个词比较合适,所...

weixin_42531494的博客 409

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

Windows获取系统版本号

直接调用下列代码即可 using namespace std; struct WindowVersion{ DWORD marjorVer; //大版本号 DWORD minorVer; // 小版本号 DWORD buildNumber; //构建版本号 }; //获取系统版本 WindowVersion getSystemVersion() { WindowVersion wv; ...

MusicMan 939

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

GetVersion和GetVersionEx的介绍

概述: DWORD WINAPI GetVersion(void); 返回当前操作系统的版本,如果调用成功,返回值的低位字中包含操作系统的主版本与次版本,高位字节包含有操作系统build号。对于所有平台,低位字包含操作系统的版本号, 低位字的低字节是系统的主版本号,用十六进制表示;低位字的高字节表示系统的次版本号,用十六进制表示,高位字表示系统的bulid号。 示例: #include <Windows.h> #include <stdio.h> int main() { .

thanklife的专栏 1485

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

WindowsAPI使用详解——GetVersion|GetVersionEx 获取操作系统版本和名称

Windows API中有两个函数可以得到系统版本信息:GetVersion和GetVersionEx。 GetVersion这个函数曾经困扰了很多程序员,其本来设计的是在DWORD返回值中用低位的那个字表示MS-DOS的版本号,高位的那个字表示Windows版本号。对于每个字来说,高位字节代表主要版本号,低位字节代表次要版本号。可是因为编写此函数的程序员犯了一个错误,使得...

weixin_30352645的博客 3005

GetVersionEx函数

Windows发展还是非常快速的,从Win95,到Win98,再到Win2000和XP系统。每个系统的功能也有所不同,要想在程序里区别不同的系统,就需要获取系统的版本信息。比如XP里有防火墙,而其它以前的系统里没有带有的。但有时编写了一个服务器程序,或者编写BT程序,又需要设置一个端口对外面接收连接,因此在XP系统里就需要设置防火墙的端口,而在XP以前的系统里就没有必要设置端口了。这样的需求,就可

芝麻软件工作室的专栏 489

windows版本号的获取

一、 GetVersionEx   这种方法,在windows 8之前都是没有问题的,但是win8后就有问题。Win8下面运行正常的显示为6.2.9200 , 但是接下来在Win8.1下面测试尽然还是6.2.9200。经过查证,实际上这个问题并非bug,而是微软有意为之。如果程序的目标运行平台不需要支持Win8.1,那么GetVersion(Ex)就给你返回6.2,除非通过App

骑着蜗牛找马儿 1442

GetVersionEx 获取系统版本信息

转自:http://blog.csdn.net/yyingwei/article/details/8286658 最近在windows 8上获取系统版本信息需要调用系统API,于是用到了GetVersionEx。 首先看一看函数原型: [cpp] view plain copy BOOL GetVersionEx(POSVERSI

Wanda && Aidem 2875

C++ 获取系统版本错误解决方法

获取系统版本错误解决方法 win 10下通过GetVersionEx无法准确获取系统的版本号,获取后显示是win 8.1的版本号 方法一: https://blog.csdn.net/daiafei/article/details/50401162 方法二: https://stackoverflow.com/questions/35474237/windows-10-versionhelper-h 1.加载清单文件,使用记事本创建一个名为“ appname.exe.manifest”的文件。 2.添加一下

God_Wei的博客 1178

C++ 获取系统版本号

因用到系统版本号,区别对待。 // 5.0 Windows 2000"; // 5.1 Windows XP"; // 5.2 Windows 2003"; // 6.0 Windows Vista"; // 6.1 Windows 7"; // 6.2 Windows 8"; // 6.3 Windows 8.1"; // 10.0 ...

Hsw1990的博客 1377

Windows 系统 内部版本号

注:win2000以前不能使用"RtlGetNtVersionNumbers",ntdll.dll还未实现它,可以使用使用GetVersionEx。

weixin_48257887的博客 3768

获取系统版本号

1 #define WINXP 5 2 #define WIN7 6 3 #define WIN7X32 632 4 //获取系统版本号 5 DWORD GetOSVer() 6 { 7 OSVERSIONINFO osver; 8 osver.dwOSVersionInfoSize = sizeof(OSVERS...

dengjiatao9832的博客 148
下一篇: NSIS 获取最大容量盘符
lbxxxxx
博客等级 码龄16年 0粉丝 1原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值