Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am calling BindToObject method of System.Runtime.InteropServices.ComTypes of IMoniker interface. And it is returning Insufficient memory exception.

I am writing code to capture Images from webcam using Imoniker.
Below is code snippet.

C#
// create bind context
            if ( Win32.CreateBindCtx( 0, out bindCtx ) == 0 )
            {
                // convert moniker`s string to a moniker
                if ( Win32.MkParseDisplayName( bindCtx, filterMoniker, ref n, out moniker ) == 0 )
                {   
                    // get device base filter
                    Guid filterId = typeof( IBaseFilter ).GUID;
                    moniker.BindToObject(null, null, ref filterId, out filterObject);
                    
                    Marshal.ReleaseComObject( moniker );
                    
                }
                Marshal.ReleaseComObject( bindCtx );
            }

What I have tried:

Tried but unable to find reason where it is getting failed
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900