none
Capturing and saving image from camera using DirectShow

    Question

  • Hello, I have a few compilation errors in my project. Please, advise me how can I correct those errors. I would be grateful for any help. Thanks

    There are the following errors (errors are bold and underlined, the code is italic) :

    - the function "array<String ^> ^BensShow::getFilterName_St()" 
    gives errors, both in its prototype, and in its definition

    prototype: 
    array<String ^> ^getFilterName_St();

    definition: 

    array<String ^> ^BensShow::getFilterName_St()
    {
    IMoniker *pTMoniker = NULL; IPropertyBag *pTPropBag;
    ULONG cFetched; hr = NULL;
    array<String ^> filternames = gcnew array<String ^>(1); VARIANT varName;
    bstr_t orig;
    int cnt = -1;

    while (this->pEnumCat->Next(1, &pTMoniker, &cFetched) == S_OK)
    {

    {
    hr = pTMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void **)&pTPropBag);
    if (SUCCEEDED(hr))
    {
    VariantInit(&varName);
    hr = pTPropBag->Read(L"FriendlyName", &varName, 0);

    if (SUCCEEDED(hr))
    {
    BSTR o = (varName.bstrVal);
    filternames[++cnt] = Marshal::PtrToStringBSTR((IntPtr)o);
    Array::Resize(filternames, filternames->Length + 1);
    }

    VariantClear(&varName);

    } }
    }
    this->pEnumCat->Reset();
    pTMoniker->Release();
    pTPropBag->Release();
    return filternames;
    }


    - declaring "array<Bitmap ^>" gives errors

    public:
    array<Bitmap ^> ^BitmapBuffer;
    Bitmap^ bmpN;
    ImageList^ imageList;

    };
    BensBitmaps::BensBitmaps()
    {
    this->bmpN = gcnew Bitmap(10, 10);
    BitmapBuffer = gcnew array<Bitmap ^>(500);
    }
    BensBitmaps::BensBitmaps(int size)
    {
    this->bmpN = gcnew Bitmap(10, 10);
    BitmapBuffer = gcnew array<Bitmap ^>(size);
    }


    Friday, September 09, 2016 11:37 AM