PDA

View Full Version : How could i get the Propertiepage for a Pin?



FS7
February 13, 2009, 16:25:08
Hello,

I want to pop up the Propertiepage for a Pin. How could i do this?

I'm using the MV Smart Control...

I know it for a Filter. Is it an similar way?

HRESULT hr = E_INVALIDARG;
try
{
IMVSCFilterPropertiesPtr pFProps = m_SmartCtrl.GetControlUnknown();
if(pFilterProperties != NULL)
pFilterProperties->ShowProperties(szFilter.AllocSysString());
}
catch(_com_error e)
{
hr = e.Error();
}

Best Regards
Fabian

FS7
March 2, 2009, 15:08:28
Hi.

Attached is a solution...

FS7
March 2, 2009, 15:09:51
HRESULT GetPin( IBaseFilter * pFilter, PIN_DIRECTION dirrequired, int iNum, IPin **ppPin)
{
CComPtr< IEnumPins > pEnum;
*ppPin = NULL;

HRESULT hr = pFilter->EnumPins(&pEnum);
if(FAILED(hr))
return hr;

ULONG ulFound;
IPin *pPin;
hr = E_FAIL;

while(S_OK == pEnum->Next(1, &pPin, &ulFound))
{
PIN_DIRECTION pindir = (PIN_DIRECTION)3;

pPin->QueryDirection(&pindir);
if(pindir == dirrequired)
{
if(iNum == 0)
{
*ppPin = pPin; // Return the pin's interface
hr = S_OK; // Found requested pin, so clear error
break;
}
iNum--;
}

pPin->Release();
}

return hr;
}