本文整理汇总了C#中IMoniker.BindToObject方法的典型用法代码示例。如果您正苦于以下问题:C# IMoniker.BindToObject方法的具体用法?C# IMoniker.BindToObject怎么用?C# IMoniker.BindToObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMoniker
的用法示例。
在下文中一共展示了IMoniker.BindToObject方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateCaptureDevice
/// <summary>
/// Luoz: 创建用户选择的设备设备
/// </summary>
bool CreateCaptureDevice(IMoniker mon)
{
object capObj = null;
try
{
Guid gbf = typeof(IBaseFilter).GUID;
mon.BindToObject(null, null, ref gbf, out capObj);
capFilter = (IBaseFilter)capObj; capObj = null;
return true;
}
catch (Exception ee)
{
MessageBox.Show(this, "Could not create capture device\r\n" + ee.Message, "DirectShow.NET", MessageBoxButtons.OK, MessageBoxIcon.Stop);
return false;
}
finally
{
if (capObj != null)
Marshal.ReleaseComObject(capObj); capObj = null;
}
}
示例2: DisplayPropertyPage_Device
/// <summary>
/// Displays property page for device.
/// </summary>
/// <param name="moniker">Moniker (device identification) of camera.</param>
/// <param name="hwndOwner">The window handler for to make it parent of property page.</param>
/// <seealso cref="Moniker"/>
public static void DisplayPropertyPage_Device(IMoniker moniker, IntPtr hwndOwner)
{
if (moniker == null)
return;
object source = null;
Guid iid = typeof(IBaseFilter).GUID;
moniker.BindToObject(null, null, ref iid, out source);
IBaseFilter theDevice = (IBaseFilter)source;
DisplayPropertyPageFilter(theDevice, hwndOwner);
//Release COM objects
SafeReleaseComObject(theDevice);
theDevice = null;
}
示例3: CreateCaptureDevice
/// <summary> create the user selected capture device. </summary>
bool CreateCaptureDevice(IMoniker mon)
{
int hr;
object capObj = null;
try
{
Guid gbf = typeof(IBaseFilter).GUID;
Guid classID;
mon.BindToObject(null, null, ref gbf, out capObj);
capFilter = (IBaseFilter)capObj;
IPin[] pin = new IPin[2];
int count;
PinDirection pinDir;
IEnumPins enumPins;
if (capFilter.EnumPins(out enumPins) == 0)
{
if (((hr = enumPins.Next(1, pin, out count)) == 0))
{
pin[0].QueryDirection(out pinDir);
if (pinDir == PinDirection.Output)
captureDevOutPin = pin[0];
if (count > 1)
Marshal.ReleaseComObject(pin[1]);
}
Marshal.ReleaseComObject(enumPins);
}
if (captureDevOutPin == null)
throw new Exception("Cannot find output pin for capture device");
return true;
}
catch (Exception ee)
{
LogInfo(LogGroups.Console, "Could not create capture device\r\n" + ee.Message);
return false;
}
//finally
//{
// if (capObj != null)
// {
// Marshal.ReleaseComObject(capObj);
// capObj = null;
// }
//}
}