如何在X86程序中获得英伟达驱动程序版本? 我需要的是英伟达2号版本(例如368.39),在 C++ +/Cux>程序中检索。使用Windows764B
是如何使用Nvidia提供的库在64位应用程序中执行此操作的 但是,随Nvidia驱动程序分发的如何在X86程序中获得英伟达驱动程序版本? 我需要的是英伟达2号版本(例如368.39),在 C++ +/Cux>程序中检索。使用Windows764B,c++,driver,gpu,nvidia,C++,Driver,Gpu,Nvidia,是如何使用Nvidia提供的库在64位应用程序中执行此操作的 但是,随Nvidia驱动程序分发的nvml.dll仅为64位。无法在我的32位程序中动态加载此库。这是假设您的计算机是64位的。我还没有在32位机器上测试过这个 到目前为止,NVML似乎是唯一允许检索此信息的库。如果有的话,还有什么其他方法可以得到这个结果呢?我假设您使用的是windows,因为您提到了“.dll” 在windows中,您应该能够使用WMI获取所需的任何硬件信息。对于显示适配器,请使用Win32\u VideoCont
nvml.dll
仅为64位。无法在我的32位程序中动态加载此库。这是假设您的计算机是64位的。我还没有在32位机器上测试过这个
到目前为止,NVML似乎是唯一允许检索此信息的库。如果有的话,还有什么其他方法可以得到这个结果呢?我假设您使用的是windows,因为您提到了“.dll” 在windows中,您应该能够使用WMI获取所需的任何硬件信息。对于显示适配器,请使用Win32\u VideoController WMI类,它有一个名为driverversion的字符串字段,该字段应具有所需的内容
//---------------------------------------------------------------------
//(windows)如何获取nvidea驱动程序版本?
// ---------------------------------------------------------------------
定义C(a){STD::CouthSuffice,英伟达驱动程序的文件版本,如第一个链接中所示。我需要2个数字版本标识符。如果有一个方法可以转换一个或找到一个涉及两个标识符的表,我也想知道。谢谢。
// ---------------------------------------------------------------------
// (windows) how to get the nvidea driver version?
// ---------------------------------------------------------------------
#define C(a) {std::cout<<a<<std::endl;} // for easy print out to console
template <class T> inline std::string TOSTR(const T fp){ // a macro
std::ostringstream o;
o.setf(std::ios_base::fixed, std::ios_base::floatfield);
o << fp; // << ends; (null-terminator character)
return std::string(o.str());
}
// ---------------------------------------------------------------------
#pragma comment(lib,"nvapi.lib") // needed !
#include <nvapi.h> // needed !
// you have to start nvapi:
NvAPI_Status ret(NVAPI_OK);
ret = NvAPI_Initialize();
if(ret != NVAPI_OK) {
NvAPI_ShortString string;
NvAPI_GetErrorMessage(ret, string);
printf("NVAPI NvAPI_Initialize: %s\n", string);
}
NvAPI_Status s;
NvU32 v; // version
NvAPI_ShortString b; // branch
s = NvAPI_SYS_GetDriverAndBranchVersion(&v, b);
if(s != NVAPI_OK) {
NvAPI_ShortString string;
NvAPI_GetErrorMessage(s, string);
printf("NvAPI_SYS_GetDriverAndBranchVersion: %s\n", string);
}
C("Nvidea driver version: " + TOSTR(v)); // app, console output
// ...hope i can help ....