Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/317.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何从c调用OleCreatePropertyFrameIndirect#_C#_Winapi_C++ Cli_Directx_Directshow - Fatal编程技术网

C# 如何从c调用OleCreatePropertyFrameIndirect#

C# 如何从c调用OleCreatePropertyFrameIndirect#,c#,winapi,c++-cli,directx,directshow,C#,Winapi,C++ Cli,Directx,Directshow,我正在用c语言编写一个应用程序,它需要显示一个属性页。我有密码: ISpecifyPropertyPages pProp = sourceObject as ISpecifyPropertyPages; int hr = 0; //Get the name of the filter from the FilterInfo struct FilterInfo filterInfo; hr = ((IBaseFilter) sourceObject).QueryFilterInfo(out fi

我正在用c语言编写一个应用程序,它需要显示一个属性页。我有密码:

ISpecifyPropertyPages pProp = sourceObject as ISpecifyPropertyPages;
int hr = 0;

//Get the name of the filter from the FilterInfo struct
FilterInfo filterInfo;
hr = ((IBaseFilter) sourceObject).QueryFilterInfo(out filterInfo);
//DsError.ThrowExceptionForHR(hr);
if (hr == 0)
{
// Get the propertypages from the property bag
CAUUID caGUID;
hr = pProp.GetPages(out caGUID);

if (hr == 0)
{
    // Create and display the OlePropertyFrame
    hr = Win32.OleCreatePropertyFrame(parentWindowForPropertyPage, 0, 0,
                      filterInfo.achName, 1,ref sourceObject,
                      caGUID.cElems,
                      caGUID.pElems, 0, 0, IntPtr.Zero);
}
// Release COM objects
Marshal.ReleaseComObject(pProp);
Marshal.FreeCoTaskMem(caGUID.pElems);
}

。。。如果源代码未运行,则该操作正常-如果源代码正在运行,则属性窗口将闪烁并立即退出。我猜我需要使用OleCreatePropertyFrameIndirect,并将其与现有对象一起调用,但我找不到任何通过c#实现这一点的示例-有什么想法吗?

OleCreatePropertyFrameIndirect不太可能出现问题。更可能的情况是,属性页本身(和/或源过滤器)出现问题并关闭、引发异常、生成访问冲突等。

是的,虽然hr返回零,但不确定从何处开始,它返回零,因为错误由属性表内部捕获。首先,它甚至可能不是一个错误——想想一个属性页在它的托管页上调用[出于任何奇怪的原因]
EndDialog
。我见过的一些其他软件可以在它运行时访问属性页,所以可以这样做。调用间接方法大概是我能想到的唯一一件事。