zoukankan      html  css  js  c++  java
  • 获取设备管理器中显卡

    #include <stdio.h>
    #include <windows.h>
    #include <Setupapi.h>
    #include <devguid.h>
    #include "tchar.h"
    
    #pragma comment(lib, "SetupAPI.lib")
    int main(int argc, char ** argv) 
    {
      HDEVINFO deviceInfoSet;
      GUID *guidDev = (GUID*) &GUID_DEVCLASS_DISPLAY; 
      deviceInfoSet = SetupDiGetClassDevs(guidDev, NULL, NULL, DIGCF_PRESENT | DIGCF_PROFILE);
     TCHAR buffer [4000];
      DWORD buffersize =4000;
      int memberIndex = 0;
      while (true) 
      {
       SP_DEVINFO_DATA deviceInfoData;
       ZeroMemory(&deviceInfoData, sizeof(SP_DEVINFO_DATA));
       deviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
      if (SetupDiEnumDeviceInfo(deviceInfoSet, memberIndex, &deviceInfoData) == FALSE) 
      {
         if (GetLastError() == ERROR_NO_MORE_ITEMS) 
         {
           break;
         }
       }
       DWORD nSize=0 ;
       SetupDiGetDeviceInstanceId (deviceInfoSet, &deviceInfoData, buffer, sizeof(buffer), &nSize);
       buffer [nSize] ='\0';
       _tprintf (_T("%s\n"), buffer);
       BOOL res = SetupDiGetDeviceRegistryProperty(deviceInfoSet, &deviceInfoData,SPDRP_DEVICEDESC, 0, (BYTE*) buffer, sizeof(buffer), NULL);
       buffer [nSize] ='\0';
       _tprintf (_T("%s\n"), buffer);
       memberIndex++;
      }
      if (deviceInfoSet) 
      {
       SetupDiDestroyDeviceInfoList(deviceInfoSet);
      }
      return 0;
    }
    View Code

     http://www.codeproject.com/Articles/6597/CDeviceTree

    http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/2555943e-0c69-4357-a85b-d6540bcaaf84

  • 相关阅读:
    表单
    超链接
    图像
    表格
    排列清单控制标
    HTML基本结构
    如何快速查看网页源代码
    TOR的使用
    google搜索新姿势
    [NOIP2017]列队
  • 原文地址:https://www.cnblogs.com/logitechlike/p/3077047.html
Copyright © 2011-2022 走看看