tags:

views:

26

answers:

1

Way 1:

HRESULT hr = CoCreateInstance(CLSID_FilterGraph, NULL, 
    CLSCTX_INPROC_SERVER,IID_PPV_ARGS(&pGraph));

Way 2:

hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, 
                    IID_IGraphBuilder, (void **)&pGraph);

What's the difference, why ?

A: 

IID_PPV_ARGS Macro

Used to retrieve an interface pointer, supplying the IID value of the requested interface automatically based on the type of the interface pointer used. This avoids a common coding error by checking the type of the value passed at compile time.

MSDN link

humbagumba