//...Thanks,
stlsoft::ref_ptr<IGraphBuilder> pGraph;
stlsoft::ref_ptr<IMediaControl> pMediaControl;
//...
1. pMediaControl.set(interface_cast_addref<IMediaControl*>(pGraph.get()), false); // this is OK
2. pMediaControl.set(interface_cast_addref<IMediaControl*>(pGraph), false); // this blows up.
3. pMediaControl = interface_cast<IMediaControl>(pGraph); // this is OK
As far as I can remember, the adjustment to interface_cast_addref<> to take ref_ptr<X> arguments has _not_ been done, so the code as you've written it will not work.However, the following (cleaner, nicer, more transparent) version should://...
stlsoft::ref_ptr<IGraphBuilder> pGraph;
stlsoft::ref_ptr<IMediaControl> pMediaControl;
//...
if(SUCCEEDED(co_create_instance(CLSID_FilterGraph, pGraph)))
{
pMediaControl = interface_cast<IMediaControl>(pGraph);
//...
:-)Matt