首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >C#:如何使用directshow.net显示此对话框?

C#:如何使用directshow.net显示此对话框?
EN

Stack Overflow用户
提问于 2011-01-21 10:58:25
回答 2查看 3.1K关注 0票数 2

如何使用Directshow.net调用此对话框?

Filter graph

EN

回答 2

Stack Overflow用户

发布于 2011-02-18 07:39:29

假设您有一个IBaseFilter引用,下面这样的代码就可以工作了:

代码语言:javascript
复制
[DllImport("oleaut32.dll", CharSet = CharSet.Auto)]
    internal static extern int OleCreatePropertyFrame(
        IntPtr hwndOwner,
        uint x, uint y,
        [MarshalAs(UnmanagedType.LPWStr)]
        string caption,
        uint objectCount,
        [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.IUnknown)]
        object[] lplpUnk,
        int cPages,
        IntPtr pageClsID,
        Guid lcid,
        uint dwReserved,
        IntPtr lpvReserved);

    public void DisplayPropertyPages(Form form, IBaseFilter filter)
    {
            var propertyPages = filter as ISpecifyPropertyPages;
            DsCAUUID pages;
            FilterInfo info;
            int hr = filter.QueryFilterInfo(out info);
            DsError.ThrowExceptionForHR(hr);
            if (propertyPages == null)
            {
                throw new ApplicationException("IBaseFilter doesn't implement ISpecifyPropertyPages");
            }
            hr = propertyPages.GetPages(out pages);
            DsError.ThrowExceptionForHR(hr);
            var filters = new IBaseFilter[1];
            filters[0] = filter;
            hr = OleCreatePropertyFrame(form.Handle, 0, 0, info.achName, 1, filters,
                pages.cElems, pages.pElems, Guid.Empty, 0, IntPtr.Zero);
            Marshal.FreeCoTaskMem(pages.pElems);
            DsError.ThrowExceptionForHR(hr);
    }
票数 6
EN

Stack Overflow用户

发布于 2014-08-24 20:17:44

请查看MSDN中OleCreatePropertyFrame()的描述。

代码语言:javascript
复制
Guid lcid is invalid. Result:
Managed Debugging Assistant 'PInvokeStackImbalance' has detected a problem in 'D:\CVS\Dev\Filters\H264\H264mfxEncoder\Samples\C#\H264EncoderTest\bin\Debug\H264EncoderTest.vshost.exe'.
Additional Information: A call to PInvoke function 'H264EncoderTest!H264EncoderTest.CGraph::OleCreatePropertyFrame' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.

必须是:

代码语言:javascript
复制
uint lcid and hr = OleCreatePropertyFrame(form.Handle, 0, 0, info.achName, 1, filters, pages.cElems, pages.pElems, 0, 0, IntPtr.Zero);
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4754971

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档