设备管量器-> 属性-> 驱动程序->   在(驱动程序详细信息)按钮中所显示的东西,中的信息该怎能么获取啊,急~~~急~~~

解决方案 »

  1.   

    接分! 注册表,HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class
    下面依此读取所有的项,直到找到Class键的值为Display(显卡)或MEDIA(声卡),也可通过专有的函数!
     
    以下代码获取显卡(前提是你装了Directx9.0):   
                                D3DDISPLAYMODE   primaryDesktopDisplayMode;   
              m_pD3D->GetAdapterDisplayMode(0,   &primaryDesktopDisplayMode);   
        
              D3DAdapterInfo*   pBestAdapterInfo   =   NULL;   
              D3DDeviceInfo*   pBestDeviceInfo   =   NULL;   
              D3DDeviceCombo*   pBestDeviceCombo   =   NULL;   
        
              for(   UINT   iai   =   0;   iai   <   m_d3dEnumeration.m_pAdapterInfoList->Count();   iai++   )   
              {   
                      D3DAdapterInfo*   pAdapterInfo   =   (D3DAdapterInfo*)m_d3dEnumeration.m_pAdapterInfoList->GetPtr(iai);   
                      for(   UINT   idi   =   0;   idi   <   pAdapterInfo->pDeviceInfoList->Count();   idi++   )   
                      {   
                              D3DDeviceInfo*   pDeviceInfo   =   (D3DDeviceInfo*)pAdapterInfo->pDeviceInfoList->GetPtr(idi);   
                              if   (bRequireHAL   &&   pDeviceInfo->DevType   !=   D3DDEVTYPE_HAL)   
                                      continue;   
                              if   (bRequireREF   &&   pDeviceInfo->DevType   !=   D3DDEVTYPE_REF)   
                                      continue;   
                              for(   UINT   idc   =   0;   idc   <   pDeviceInfo->pDeviceComboList->Count();   idc++   )   
                              {   
                                      D3DDeviceCombo*   pDeviceCombo   =   (D3DDeviceCombo*)pDeviceInfo->pDeviceComboList->GetPtr(idc);   
                                      bool   bAdapterMatchesBB   =   (pDeviceCombo->BackBufferFormat   ==   pDeviceCombo->AdapterFormat);   
                                      if   (!pDeviceCombo->IsWindowed)   
                                              continue;   
                                      if   (pDeviceCombo->AdapterFormat   !=   primaryDesktopDisplayMode.Format)   
                                              continue;   
                                      //   If   we   haven't   found   a   compatible   DeviceCombo   yet,   or   if   this   set   
                                      //   is   better   (because   it's   a   HAL,   and/or   because   formats   match   better),   
                                      //   save   it   
                                      if(   pBestDeviceCombo   ==   NULL   ||     
                                              pBestDeviceCombo->DevType   !=   D3DDEVTYPE_HAL   &&   pDeviceCombo->DevType   ==   D3DDEVTYPE_HAL   ||   
                                              pDeviceCombo->DevType   ==   D3DDEVTYPE_HAL   &&   bAdapterMatchesBB   )   
                                      {   
                                              pBestAdapterInfo   =   pAdapterInfo;   
                                              pBestDeviceInfo   =   pDeviceInfo;   
                                              pBestDeviceCombo   =   pDeviceCombo;   
                                              if(   pDeviceCombo->DevType   ==   D3DDEVTYPE_HAL   &&   bAdapterMatchesBB   )   
                                              {   
                                                      //   This   windowed   device   combo   looks   great   --   take   it   
                                                      goto   EndWindowedDeviceComboSearch;   
                                              }   
                                              //   Otherwise   keep   looking   for   a   better   windowed   device   combo   
                                      }   
                              }   
                      }   
      以上是主要代码,不过不是全部代码(太长了),建议你装上DX9,打开VC生成向导,选DX9APPWIZARD,看一下初始过程。
      

  2.   

    好象只能获取一般的信息吧,不光是显卡和声卡,还包括其它的硬件,那该怎么实现呢,用SETUPAPI能获取吗