VideoHelp Forum
+ Reply to Thread
Results 1 to 7 of 7
Thread
  1. Member
    Join Date
    Dec 2007
    Location
    Pakistan
    Search Comp PM
    i am writing a program to capture video from my webcam. every thing is fine except that the compiler gives error for ICaptureGraphBuilder2 *pCaptureGraphBuilder2.

    error C2065: 'ICaptureGraphBuilder2' : undeclared identifier

    i am using VC++ 6.0
    Quote Quote  
  2. More information please.

    What SDKs do you have installed? You are probably missing strmif.h (or, if you have the right SDK, just haven't included it. Once you do, you'll probably get a whole load of missing symbol errors when linking, too).

    Is that the only error you get?

    Can you post your code and all the compiler output? It's hard to tell what's going wrong without it.
    Quote Quote  
  3. Member
    Join Date
    Dec 2007
    Location
    Pakistan
    Search Comp PM
    i have installed DirectMedia SDK 6.0

    #include<stdio.h>
    #include<dshow.h>
    #include<strmif.h>



    void main()

    {


    ULONG nFetched = 0;

    IGraphBuilder *graphb;

    ICaptureGraphBuilder2 *pCaptureGraphBuilder2;

    IMediaControl *mediac;

    ICreateDevEnum *listofdevices;

    IEnumMoniker *devicecategory;

    IMoniker *monik;

    IPropertyBag *pPropertyBag;

    IBaseFilter *filter;





    CoInitialize(NULL);


    CoCreateInstance(CLSID_FilterGraph,NULL,CLSCTX_INP ROC,IID_IGraphBuilder,(LPVOID*)&graphb);

    CoCreateInstance(CLSID_CaptureGraphBuilder2,NULL,C LSCTX_INPROC,IID_ICaptureGraphBuilder,(LPVOID*)&pC aptureGraphBuilder2);


    graphb->QueryInterface(IID_IMediaControl,(LPVOID*)&mediac );


    CoCreateInstance(CLSID_SystemDeviceEnum,NULL,CLSCT X_INPROC,IID_ICreateDevEnum,(LPVOID*)&listofdevice s);


    listofdevices->CreateClassEnumerator(CLSID_VideoInputDeviceCateg ory,&devicecategory,0);





    while (devicecategory->Next(1, &monik, &nFetched) == S_OK)

    {


    TCHAR devname[128];


    monik->BindToStorage(0, 0, IID_IPropertyBag,(void **)&pPropertyBag);


    VARIANT varFriendlyName;

    varFriendlyName.vt = VT_BSTR;


    pPropertyBag->Read(L"FriendlyName", &varFriendlyName, 0);




    #ifdef UNICODE

    _tcscpy(devname, varFriendlyName.bstrVal);
    #else

    WideCharToMultiByte(CP_ACP, 0,varFriendlyName.bstrVal, -1, devname, sizeof(devname), 0, 0);
    #endif

    puts(devname);



    VariantClear(&varFriendlyName);

    monik->BindToObject(0, 0, IID_IBaseFilter,(void**)&filter);



    monik->Release();
    pPropertyBag->Release();

    break;
    }


    pCaptureGraphBuilder2->SetFiltergraph(graphb);

    graphb->AddFilter(filter, L"Device Filter");



    pCaptureGraphBuilder2->RenderStream(&PIN_CATEGORY_PREVIEW,NULL, filter, NULL,NULL);





    mediac->Run();


    Sleep(100000000);





    graphb->Release();
    mediac->Release();


    devicecategory->Release();
    listofdevices->Release();

    CoUninitialize();

    }


    errors :

    error C2065: 'ICaptureGraphBuilder2' : undeclared identifier
    error C2065: 'pCaptureGraphBuilder2' : undeclared identifier
    error C2065: 'CLSID_CaptureGraphBuilder2' : undeclared identifier
    error C2227: left of '->SetFiltergraph' must point to class/struct/union
    error C2227: left of '->RenderStream' must point to class/struct/union
    Error executing cl.exe.
    Quote Quote  
  4. Your SDK is out of date.

    You need the current version of the DirectShow SDK. This is part of the latest Platform SDK or Windows SDK (they are different). Don't download the DirectX SDK - all the DirectShow stuff has been removed.
    Quote Quote  
  5. Member
    Join Date
    Dec 2007
    Location
    Pakistan
    Search Comp PM
    first of all thx for ur response.

    i hve downloaded a new strmif.h from www.koders.com

    the problem has solved but now it gives other errors

    : error C2146: syntax error : missing ';' before identifier 'HSEMAPHORE'
    : fatal error C1004: unexpected end of file found


    when i click the errors it takes me to strmif.h file.

    what is this ?
    Quote Quote  
  6. You need the current Windows Software Development Kit or Platform Software Development Kit. It contains everything that is required for DirectShow applications including lots of examples showing what libraries are needed etc. They come with Visual Studio solutions but they may not open in 6.0.

    I recommend the Platform SDK:

    http://www.microsoft.com/downloads/details.aspx?FamilyId=484269E2-3B89-47E3-8EB7-1F2BE...displaylang=en

    It's big - 400MB but smaller than the other one (1.1GB).

    Once installed, you will need to add the DirectShow base libraries and includes to your paths.

    C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Samples\Multimedia\DirectShow\BaseClasses
    Quote Quote  
  7. Member
    Join Date
    Dec 2007
    Location
    Pakistan
    Search Comp PM
    the problem has solved.

    thx for ur kind help.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!