本文介绍了通过WinAPI确定英特尔高清显卡版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我试图通过WinAPI函数获取有关显卡的信息,但对如何获取我的确切卡信息存在疑问。我已经编写代码来调用EnumDisplayDevices,并通过我的电话接收DeviceStringIntel(R)HD Graphics Family。但是,这并不能告诉我确切的卡片,例如英特尔高清显卡系列有4200,4400等等(根据我的理解)。

我搜索了更多关于如何找到这些信息的方法,甚至通过注册表查看仍然使我得到英特尔(R)高清显卡系列的描述字符串。 ..现在我在这里。非常感谢任何能够帮助我的人,它实际上是一个stackoverflow线程,它使我向EnumDisplayDevices的方向发展:)

解决方案

我会使用 OpenGL 替代 WinAPI ,因为我不知道 WinAPI 是否有这样的功能,研究。是的,您可以搜索注册表项来获取此信息,但由于可能的位置/名称更改,将来不安全。 OpenGL 方式非常简单:


  1. 创建 OpenGL 渲染上下文
  2. >
  3. 获取适当的供应商和设备字符串。

  4. 发布 OpenGL 渲染上下文

它适用于任何支持 OpenGL 1.0 OpenGL 功能的图形卡/驱动程序,它们都是现在的显卡。




  • 请参阅:。



    要获取 PCI ID ,您可以使用以下内容: /stackoverflow.com/a/44236643/2521214\"> my setupapi.h C. ++示例




只要将解析字符串从 TEXT(USB) TEXT(PCI)并选中 VID 8086 设备所以:
$ b

  bool PCIinfo()
{
int i,n ;
AnsiString s,txt =;
DWORD dwSize,dwPropertyRegDataType;
HDEVINFO hDevInfo;
SP_DEVINFO_DATA DeviceInfoData;
TCHAR szDesc [1024];

// hDevInfo = SetupDiGetClassDevs(NULL,NULL,NULL,DIGCF_PRESENT | DIGCF_ALLCLASSES); //列出所有设备
// hDevInfo = SetupDiGetClassDevs(NULL,TEXT(USB),NULL,DIGCF_PRESENT | DIGCF_ALLCLASSES); //列出所有连接的USB设备
hDevInfo = SetupDiGetClassDevs(NULL,TEXT(PCI),NULL,DIGCF_PRESENT | DIGCF_ALLCLASSES); //列出所有连接的PCI设备

if(hDevInfo == INVALID_HANDLE_VALUE)return false;
//找到无驱动程序
(i = 0 ;; i ++)
{
DeviceInfoData.cbSize = sizeof(DeviceInfoData);
if(!SetupDiEnumDeviceInfo(hDevInfo,i,& DeviceInfoData))break;
SetupDiGetDeviceRegistryProperty(hDevInfo,& DeviceInfoData,SPDRP_DEVICEDESC,& dwPropertyRegDataType,(BYTE *)szDesc,sizeof(szDesc),& dwSize);
s = szDesc; N = 48; while(s.Length() SetupDiGetDeviceRegistryProperty(hDevInfo,& DeviceInfoData,SPDRP_HARDWAREID,& dwPropertyRegDataType,(BYTE *)szDesc,sizeof(szDesc),& dwSize);
s = szDesc; N = 64; while(s.Length() SetupDiGetDeviceRegistryProperty(hDevInfo,& DeviceInfoData,SPDRP_LOCATION_INFORMATION,& dwPropertyRegDataType,(BYTE *)szDesc,sizeof(szDesc),& dwSize);
s = szDesc; N = 40; while(s.Length() txt + =\r\\\
;
}
Main-> mm_log-> Lines-> Add(txt);
返回true;
}

代码在我的设置中返回:


PCI标准主CPU桥PCI \VEN_1022& DEV_1400& SUBSYS_00000000& REV_00 PCI总线0,设备24,功能0
PCI标准主CPU桥PCI \ VEN_1022& DEV_1401& SUBSYS_00000000& REV_00 PCI总线0,设备24,功能1
PCI标准主CPU桥PCI \VEN_1022& DEV_1402& SUBSYS_00000000& REV_00 PCI总线0,设备24,功能2
PCI标准主CPU桥PCI_VEN_1022& DEV_1403& SUBSYS_00000000& REV_00 PCI总线0,设备24,功能3
PCI标准主机CPU桥PCI \VEN_1022& DEV_1404& SUBSYS_00000000& REV_00 PCI总线0,设备24,功能4
PC PCI标准主CPU桥PCI \VEN_1022& DEV_1410& SUBSYS_14101022& REV_00 PCI总线0,设备0,设备24,功能5 $ b $功能0
PCI Express标准根端口PCI\VEN_1022&安培; DEV_1412&安培; SUBSYS_12341022&安培; REV_00 PCI总线0,设备2,功能0
PCI Express标准根端口PCI\VEN_1022&安培; DEV_1414&安培; SUBSYS_12341022&安培; REV_00 PCI总线0,设备4,功能0
PCI Express标准根端口PCI \VEN_1022& DEV_1417& SUBSYS_12341022& REV_00 PCI总线0,设备7,功能0
AMD IOMMU设备PCI \VEN_1022& DEV_1419& SUBSYS_14191022&安培; REV_00 PCI总线0,设备0,功能2
AMD SATA控制器PCI \VEN_1022& DEV_7801& SUBSYS_B0021458& REV_40 PCI总线0,设备17,功能0
标准OpenHCD USB主机控制器PCI \VEN_1022& DEV_7807& amp ; SUBSYS_50041458& REV_11 PCI总线0,设备18,功能0
标准OpenHCD USB主控制器PCI \VEN_1022& DEV_7807& SUBSYS_50041458& REV_11 PCI总线0,设备19,功能0
标准增强PCI到USB主机控制器PCI\VEN_1022&安培; DEV_7808&安培; SUBSYS_50041458&安培; REV_11 PCI总线0,设备18,功能2
标准的PCI到USB主机控制器PCI\VEN_1022&安培; DEV_7808&安培; SUBSYS_50041458&安培; REV_11 PCI总线0,设备19,功能2
标准OpenHCD USB主机控制器PCI\VEN_1022&安培; DEV_7809&安培; SUBSYS_50041458&安培; REV_11 PCI总线0,设备20,功能5
AMD的SMBus PCI\VEN_1022&安培; DEV_780B&安培; SUBSYS_780B1022&安培; REV_14 PCI总线0,设备20,功能0
高清晰度音频控制器PCI\VEN_1022&安培; DEV_780D&安培; SUBSYS_A0021458&安培; REV_01 PCI总线0,设备20,功能2
PCI标准ISA桥PCI\VEN_1022&安培; DEV_780E&安培; SUBSYS_780E1022&安培; REV_11 PCI总线0,设备20,功能3
PCI标准的PCI至PCI桥接器PCI\VEN_1022&安培; DEV_780F&安培; SUBSYS_00000000&安培; REV_40 PCI总线0,设备20,功能4
超微USB 3.0主机控制器PCI\VEN_1022&安培; DEV_7812&安培; SUBSYS_50041458&安培; REV_03 PCI总线0,设备16,f结0
超微USB 3.0主机控制器PCI\VEN_1022&安培; DEV_7812&安培; SUBSYS_50041458&安培; REV_03 PCI总线0,设备16,功能1个
高清晰度音频控制器PCI\VEN_10DE&安培; DEV_0BEE&安培; SUBSYS_35371458&安培; REV_A1 PCI总线1,设备0,功能1
NVIDIA GeForce GTX 550 Ti PCI \VEN_10DE& DEV_1244& SUBSYS_35371458& REV_A1 PCI总线1,设备0,功能0
Realtek PCIe GBE家族控制器PCI \VEN_10EC& DEV_8168& amp ; SUBSYS_E0001458& REV_06 PCI总线2,设备0,功能0
MSI TV @ Anywhere Plus PCI \VEN_1131& DEV_7133& SUBSYS_62311462& REV_D1 PCI总线4,设备6,功能0
Etron USB 3.0可扩展主机控制器PCI \VEN_1B6F& DEV_7023& SU BSYS_50071458& REV_01 PCI总线3,设备0,功能0

在不同的IntelHD图形计算机上运行它,检查是否有不同的PCI ID ...


So I am trying to get information on graphics cards via WinAPI functions, but have a question regarding how to get my exact card information. I have written code to call EnumDisplayDevices and through my call I receive back the DeviceString "Intel(R) HD Graphics Family". However this is not telling me the exact card, for example the Intel HD Graphics Family has a 4200, 4400, so on (from my understanding).

I searched around more for ways to find this information, even looking through the registry which still led me to a description string of "Intel(R) HD Graphics Family"... Now I am here. Thanks alot to anybody who can help me out, it was infact a stackoverflow thread which led me in the direction of EnumDisplayDevices in the first place :)

解决方案

I would use OpenGL instead WinAPI for this because I do not know if WinAPI even has some feature like this and too lazy to research. Yes you can search registry keys for this info but that is not safe in the future due to possible location/name change. The OpenGL way is straight forward:

  1. create OpenGL rendering context
  2. obtain the appropriate vendor and device strings.
  3. release OpenGL rendering context

It will work for any OpenGL capable graphic card/driver supporting OpenGL 1.0 which are all of the nowadays cards.

You can use OpenGL function glGetString to obtain this info:

GL_VENDOR Returns the company responsible for this OpenGL implementation. This name does not change from release to release.  
GL_RENDERER Returns the name of the renderer. This name is typically specific to a particular configuration of a hardware platform. It does not change from release to release.  
GL_VERSION Returns a version or release number (of supported OpenGL and gfx driver version)
GL_EXTENSIONS Returns a space-separated list of supported extensions to OpenGL (all capabilities of your card)

The rest is easy (using gl_init,gl_exit from second link):

gl_init(Your_App_Window_Handle);
char *vendor =(char*)glGetString(GL_VENDOR);
char *device =(char*)glGetString(GL_RENDERER);
char *version=(char*)glGetString(GL_VERSION);
char *ext    =(char*)glGetString(GL_EXTENSIONS);
gl_exit();

Mine setup returns:

vendor ="NVIDIA Corporation"
device ="GeForce GTX 550 Ti/PCIe/SSE2"
version="4.5.0 NVIDIA 347.25"
ext    ="GL_AMD_multi_draw_indirect GL_ARB_arrays_of_arrays GL_ARB_base_instance GL_ARB_blend_func_extended GL_ARB_buffer_storage GL_ARB_clear_buffer_object GL_ARB_clear_texture GL_ARB_clip_control GL_ARB_color_buffer_float GL_ARB_compatibility GL_ARB_compressed_texture_pixel_storage GL_ARB_conservative_depth GL_ARB_compute_shader GL_ARB_compute_variable_group_size GL_ARB_conditional_render_inverted GL_ARB_copy_buffer GL_ARB_copy_image GL_ARB_cull_distance GL_ARB_debug_output GL_ARB_depth_buffer_float GL_ARB_depth_clamp GL_ARB_depth_texture GL_ARB_derivative_control GL_ARB_direct_state_access GL_ARB_draw_buffers GL_ARB_draw_buffers_blend GL_ARB_draw_indirect GL_ARB_draw_elements_base_vertex GL_ARB_draw_instanced GL_ARB_enhanced_layouts GL_ARB_ES2_compatibility GL_ARB_ES3_compatibility GL_ARB_ES3_1_compatibility GL_ARB_explicit_attrib_location GL_ARB_explicit_uniform_location GL_ARB_fragment_coord_conventions GL_ARB_fragment_layer_viewport GL_ARB_fragment_program GL_ARB_fragment_program_shadow GL_ARB_fragment_shader GL_ARB_framebuffer_no_attachments GL_ARB_framebuffer_object GL_ARB_framebuffer_sRGB GL_ARB_geometry_shader4 GL_ARB_get_program_binary GL_ARB_get_texture_sub_image GL_ARB_gpu_shader5 GL_ARB_gpu_shader_fp64 GL_ARB_half_float_pixel GL_ARB_half_float_vertex GL_ARB_imaging GL_ARB_indirect_parameters GL_ARB_instanced_arrays GL_ARB_internalformat_query GL_ARB_internalformat_query2 GL_NV_internalformat_sample_query GL_ARB_invalidate_subdata GL_ARB_map_buffer_alignment GL_ARB_map_buffer_range GL_ARB_multi_bind GL_ARB_multi_draw_indirect GL_ARB_multisample GL_ARB_multitexture GL_ARB_occlusion_query GL_ARB_occlusion_query2 GL_ARB_pipeline_statistics_query GL_ARB_pixel_buffer_object GL_ARB_point_parameters GL_ARB_point_sprite GL_ARB_program_interface_query GL_ARB_provoking_vertex GL_ARB_robust_buffer_access_behavior GL_ARB_robustness GL_ARB_sample_shading GL_ARB_sampler_objects GL_ARB_seamless_cube_map GL_ARB_separate_shader_objects GL_ARB_shader_atomic_counters GL_ARB_shader_bit_encoding GL_ARB_shader_draw_parameters GL

[Notes]

you need to include only gl.h for this no need for glu,glew or anything else (except wglext.h which should be included on its own inside gl.h). It is usually located in separate include subdirectory like:

#include <gl\gl.h>

[Edit1]

As Intel OpenGL implementation does not expose the version too I see only one other option. You need to acquire PCI ID VID/PID of the card and cross check against known values:

Model               CPU arch.       Release date    PCI ID      Execution units
HD Graphics         Arrandale               2010    8086:0046   6
HD Graphics         Sandy Bridge    January 2011    8086:0106   6
HD Graphics 2000    Sandy Bridge    January 2011    8086:0102   6
HD Graphics 3000    Sandy Bridge    January 2011    8086:0116   16
HD Graphics 2500    Ivy Bridge      April 2012      8086:016A   6
HD Graphics 4000    Ivy Bridge      April 2012      8086:0166   16
HD Graphics 4400    Haswell               2013                  20
HD Graphics 4600    Haswell               2013      8086:0416   20
HD Graphics 5500    Broadwell             2015                  24

taken from here.

To obtain the PCI ID you can use this:

Just change the parsing string from TEXT("USB") to TEXT("PCI") and check VID 8086 devices so:

bool PCIinfo()
    {
    int i,n;
    AnsiString s,txt="";
    DWORD dwSize,dwPropertyRegDataType;
    HDEVINFO hDevInfo;
    SP_DEVINFO_DATA DeviceInfoData;
    TCHAR szDesc[1024];

//  hDevInfo = SetupDiGetClassDevs(NULL, NULL       , NULL, DIGCF_PRESENT|DIGCF_ALLCLASSES);    // List all devices
//  hDevInfo = SetupDiGetClassDevs(NULL, TEXT("USB"), NULL, DIGCF_PRESENT|DIGCF_ALLCLASSES);    // List all connected USB devices
    hDevInfo = SetupDiGetClassDevs(NULL, TEXT("PCI"), NULL, DIGCF_PRESENT|DIGCF_ALLCLASSES);    // List all connected PCI devices

    if (hDevInfo == INVALID_HANDLE_VALUE) return false;
    // Find the ones that are driverless
    for (i=0;;i++)
        {
        DeviceInfoData.cbSize = sizeof(DeviceInfoData);
        if (!SetupDiEnumDeviceInfo(hDevInfo, i, &DeviceInfoData)) break;
        SetupDiGetDeviceRegistryProperty(hDevInfo, &DeviceInfoData, SPDRP_DEVICEDESC,&dwPropertyRegDataType, (BYTE*)szDesc,sizeof(szDesc),&dwSize);
        s=szDesc; n=48; while (s.Length()<n) s+=" "; if (s.Length()>n) s=s.SubString(1,n); txt+=s+" ";
        SetupDiGetDeviceRegistryProperty(hDevInfo, &DeviceInfoData, SPDRP_HARDWAREID,&dwPropertyRegDataType, (BYTE*)szDesc,sizeof(szDesc),&dwSize);
        s=szDesc; n=64; while (s.Length()<n) s+=" "; if (s.Length()>n) s=s.SubString(1,n); txt+=s+" ";
        SetupDiGetDeviceRegistryProperty(hDevInfo, &DeviceInfoData, SPDRP_LOCATION_INFORMATION,&dwPropertyRegDataType, (BYTE*)szDesc,sizeof(szDesc),&dwSize);
        s=szDesc; n=40; while (s.Length()<n) s+=" "; if (s.Length()>n) s=s.SubString(1,n); txt+=s+" ";
        txt+="\r\n";
        }
    Main->mm_log->Lines->Add(txt);
    return true;
    }

that code returns on my setup this:

PCI standard host CPU bridge                     PCI\VEN_1022&DEV_1400&SUBSYS_00000000&REV_00                     PCI bus 0, device 24, function 0         
PCI standard host CPU bridge                     PCI\VEN_1022&DEV_1401&SUBSYS_00000000&REV_00                     PCI bus 0, device 24, function 1         
PCI standard host CPU bridge                     PCI\VEN_1022&DEV_1402&SUBSYS_00000000&REV_00                     PCI bus 0, device 24, function 2         
PCI standard host CPU bridge                     PCI\VEN_1022&DEV_1403&SUBSYS_00000000&REV_00                     PCI bus 0, device 24, function 3         
PCI standard host CPU bridge                     PCI\VEN_1022&DEV_1404&SUBSYS_00000000&REV_00                     PCI bus 0, device 24, function 4         
PCI standard host CPU bridge                     PCI\VEN_1022&DEV_1405&SUBSYS_00000000&REV_00                     PCI bus 0, device 24, function 5         
PCI standard host CPU bridge                     PCI\VEN_1022&DEV_1410&SUBSYS_14101022&REV_00                     PCI bus 0, device 0, function 0          
PCI Express standard Root Port                   PCI\VEN_1022&DEV_1412&SUBSYS_12341022&REV_00                     PCI bus 0, device 2, function 0          
PCI Express standard Root Port                   PCI\VEN_1022&DEV_1414&SUBSYS_12341022&REV_00                     PCI bus 0, device 4, function 0          
PCI Express standard Root Port                   PCI\VEN_1022&DEV_1417&SUBSYS_12341022&REV_00                     PCI bus 0, device 7, function 0          
AMD IOMMU Device                                 PCI\VEN_1022&DEV_1419&SUBSYS_14191022&REV_00                     PCI bus 0, device 0, function 2          
AMD SATA Controller                              PCI\VEN_1022&DEV_7801&SUBSYS_B0021458&REV_40                     PCI bus 0, device 17, function 0         
Standard OpenHCD USB Host Controller             PCI\VEN_1022&DEV_7807&SUBSYS_50041458&REV_11                     PCI bus 0, device 18, function 0         
Standard OpenHCD USB Host Controller             PCI\VEN_1022&DEV_7807&SUBSYS_50041458&REV_11                     PCI bus 0, device 19, function 0         
Standard Enhanced PCI to USB Host Controller     PCI\VEN_1022&DEV_7808&SUBSYS_50041458&REV_11                     PCI bus 0, device 18, function 2         
Standard Enhanced PCI to USB Host Controller     PCI\VEN_1022&DEV_7808&SUBSYS_50041458&REV_11                     PCI bus 0, device 19, function 2         
Standard OpenHCD USB Host Controller             PCI\VEN_1022&DEV_7809&SUBSYS_50041458&REV_11                     PCI bus 0, device 20, function 5         
AMD SMBus                                        PCI\VEN_1022&DEV_780B&SUBSYS_780B1022&REV_14                     PCI bus 0, device 20, function 0         
High Definition Audio Controller                 PCI\VEN_1022&DEV_780D&SUBSYS_A0021458&REV_01                     PCI bus 0, device 20, function 2         
PCI standard ISA bridge                          PCI\VEN_1022&DEV_780E&SUBSYS_780E1022&REV_11                     PCI bus 0, device 20, function 3         
PCI standard PCI-to-PCI bridge                   PCI\VEN_1022&DEV_780F&SUBSYS_00000000&REV_40                     PCI bus 0, device 20, function 4         
AMD USB 3.0 Host Controller                      PCI\VEN_1022&DEV_7812&SUBSYS_50041458&REV_03                     PCI bus 0, device 16, function 0         
AMD USB 3.0 Host Controller                      PCI\VEN_1022&DEV_7812&SUBSYS_50041458&REV_03                     PCI bus 0, device 16, function 1         
High Definition Audio Controller                 PCI\VEN_10DE&DEV_0BEE&SUBSYS_35371458&REV_A1                     PCI bus 1, device 0, function 1          
NVIDIA GeForce GTX 550 Ti                        PCI\VEN_10DE&DEV_1244&SUBSYS_35371458&REV_A1                     PCI bus 1, device 0, function 0          
Realtek PCIe GBE Family Controller               PCI\VEN_10EC&DEV_8168&SUBSYS_E0001458&REV_06                     PCI bus 2, device 0, function 0          
MSI TV@Anywhere Plus                             PCI\VEN_1131&DEV_7133&SUBSYS_62311462&REV_D1                     PCI bus 4, device 6, function 0          
Etron USB 3.0 Extensible Host Controller         PCI\VEN_1B6F&DEV_7023&SUBSYS_50071458&REV_01                     PCI bus 3, device 0, function 0          

so run it on different IntelHD graphics computers and check if different PCI ID is there ...

这篇关于通过WinAPI确定英特尔高清显卡版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 05:33