Click here to Skip to main content
15,915,163 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Adding header files in a project Pin
David Crow21-Jun-06 4:28
David Crow21-Jun-06 4:28 
GeneralRe: Adding header files in a project Pin
vasmvr21-Jun-06 5:03
vasmvr21-Jun-06 5:03 
GeneralRe: Adding header files in a project Pin
khb21-Jun-06 4:22
khb21-Jun-06 4:22 
GeneralRe: Adding header files in a project Pin
Zac Howland21-Jun-06 3:57
Zac Howland21-Jun-06 3:57 
QuestionDetermine graphics card Pin
khb21-Jun-06 2:59
khb21-Jun-06 2:59 
AnswerRe: Determine graphics card Pin
NiceNaidu21-Jun-06 3:10
NiceNaidu21-Jun-06 3:10 
QuestionRe: Determine graphics card [modified] Pin
khb21-Jun-06 3:23
khb21-Jun-06 3:23 
AnswerRe: Determine graphics card [modified] Pin
Viorel.21-Jun-06 3:26
Viorel.21-Jun-06 3:26 
If no other solutions, you can try Windows Management Instrumentation (WMI), which allows you to find some hardware and software details programmatically.

The next sample displays available video controller(s):

#include "stdafx.h"

#define _WIN32_WINNT 0x0400
#include <objbase.h>
#include <comdef.h>
#include <Wbemidl.h>

#pragma comment(lib, "wbemuuid.lib")

_COM_SMARTPTR_TYPEDEF(IWbemLocator, __uuidof(IWbemLocator));
_COM_SMARTPTR_TYPEDEF(IWbemServices, __uuidof(IWbemServices));
_COM_SMARTPTR_TYPEDEF(IEnumWbemClassObject, __uuidof(IEnumWbemClassObject));
_COM_SMARTPTR_TYPEDEF(IWbemClassObject, __uuidof(IWbemClassObject));


void ShowVideoControllers()
{
    CoInitializeEx(NULL, COINIT_MULTITHREADED);
    CoInitializeSecurity(
        NULL,
        -1,
        NULL,
        NULL,
        RPC_C_AUTHN_LEVEL_DEFAULT,
        RPC_C_IMP_LEVEL_IMPERSONATE,
        NULL,
        EOAC_NONE,
        NULL);

    IWbemLocatorPtr locator;

    CoCreateInstance(
        CLSID_WbemLocator,             
        0, 
        CLSCTX_INPROC_SERVER, 
        IID_IWbemLocator, 
        (LPVOID *)&locator
        );

    IWbemServicesPtr services;

    locator->ConnectServer(
         _bstr_t(L"ROOT\\CIMV2"),
         NULL,
         NULL,
         0,
         NULL,
         0,
         0,
         &services
         );


    IEnumWbemClassObjectPtr enumerator;
    services->ExecQuery(
        bstr_t("WQL"), 
        bstr_t("SELECT * FROM Win32_VideoController"),
        WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY, 
        NULL,
        &enumerator);

    IWbemClassObjectPtr object = 000;

    for( ; ; )
    {
        ULONG ret;
        enumerator->Next(WBEM_INFINITE, 1, &object, &ret);

        if( ret == 0) break;

        _variant_t variant;
        object-&Get(L"Name", 0, &variant, 0, 0);
        _bstr_t model = variant;

        MessageBox(0, model, "", MB_OK);
    }
    // TODO: check HRESULTs for error
    // TODO: release objects
}

Hope it helps.

-- modified at 9:41 Wednesday 21st June, 2006
GeneralRe: Determine graphics card Pin
khb21-Jun-06 3:47
khb21-Jun-06 3:47 
Questionstatic control Pin
ashish dogra21-Jun-06 2:47
ashish dogra21-Jun-06 2:47 
AnswerRe: static control Pin
David Crow21-Jun-06 2:48
David Crow21-Jun-06 2:48 
AnswerRe: static control Pin
_AnsHUMAN_ 21-Jun-06 2:48
_AnsHUMAN_ 21-Jun-06 2:48 
AnswerRe: static control Pin
Hamid_RT21-Jun-06 7:40
Hamid_RT21-Jun-06 7:40 
GeneralRe: static control Pin
ashish dogra21-Jun-06 3:02
ashish dogra21-Jun-06 3:02 
GeneralRe: static control Pin
happy_ram21-Jun-06 3:15
happy_ram21-Jun-06 3:15 
GeneralRe: static control Pin
ashish dogra21-Jun-06 3:17
ashish dogra21-Jun-06 3:17 
GeneralRe: static control Pin
Cedric Moonen21-Jun-06 3:29
Cedric Moonen21-Jun-06 3:29 
QuestionA Drag and Drop Handle? [modified] Pin
TheDelChop21-Jun-06 2:35
TheDelChop21-Jun-06 2:35 
AnswerRe: A Drag and Drop Handle? Pin
David Crow21-Jun-06 2:39
David Crow21-Jun-06 2:39 
AnswerRe: A Drag and Drop Handle? Pin
normanS21-Jun-06 4:47
normanS21-Jun-06 4:47 
AnswerRe: A Drag and Drop Handle? Pin
Michael Dunn21-Jun-06 6:40
sitebuilderMichael Dunn21-Jun-06 6:40 
QuestionFFMPEG +VC++ Console Programming Pin
RahulOP21-Jun-06 2:28
RahulOP21-Jun-06 2:28 
AnswerRe: FFMPEG +VC++ Console Programming Pin
NiceNaidu21-Jun-06 2:38
NiceNaidu21-Jun-06 2:38 
GeneralRe: FFMPEG +VC++ Console Programming Pin
RahulOP21-Jun-06 3:27
RahulOP21-Jun-06 3:27 
AnswerRe: FFMPEG +VC++ Console Programming Pin
Justin Tay21-Jun-06 2:44
Justin Tay21-Jun-06 2:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.