Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

CoCreateInstance and the CLSCTX_ALL flag

563 views
Skip to first unread message

mannson

unread,
Jan 20, 2007, 4:48:54 PM1/20/07
to
Hi,
I'm using the CoCreateInstance method of the ATL smart pointer to
create COM objects in my DirectShow application. Looking at the
documentation of this method, I came across the CLSCTX_ALL flag. This
equals a collection of flags and lets COM choose the appropriate
server. Now I'm curious to know, if there is difference between this
two calls:

IGraphBuilder pGraphBuilder;
CoCreateInstance (CLSID_FilterGraph, Null, CLSCTX_INPROC_SERVER,
IID_IGraphBuilder, (void **)&pGraphBuilder);

and

CComPtr<IGraphBuilder> pGraphBuilder;
pGraphBuilder.CoCreateInstance(CLSID_FilterGraph);

How do I know, what threading model COM is actually using for the
filter graph manager, if I'm going with the second version?

Thanks in advance
Stefan

Michel Roujansky - DirectShow Consultant and Trainer

unread,
Jan 20, 2007, 6:01:54 PM1/20/07
to
The flag refers to where the COM object gets activated (in process,
local server, remote).
CLSTCTX_ALL gives the freedom for the factory to try all possibilities
and take the first one that works.
However, this is purely theoretical in the case of the Filtergraph
manager, because if you look for its class in the registry, you will
see that it gets implemented by quatrz.dll, which means it can only run
in-process.
Re threading, you actually choose threading by using CLSID_FilterGraph
or CLSID_FilterGraphNoThread
see : http://msdn2.microsoft.com/en-gb/library/ms783670.aspx

rgds,

mannson

unread,
Jan 20, 2007, 7:28:56 PM1/20/07
to

On 21 Jan., 00:01, "Michel Roujansky - DirectShow Consultant and

Thanks. That whas exactly what I wanted to know. :)

Regrads
Stefan

fe...@berlinet.de

unread,
Apr 15, 2016, 1:07:34 PM4/15/16
to
Am Sonntag, 21. Januar 2007 00:01:54 UTC+1 schrieb Michel Roujansky - [MS MVP DirectShow/MediaFoundation]:

> CLSTCTX_ALL gives the freedom for the factory to try all possibilities
> and take the first one that works.

This is not quite correct; the implementation follows a strict protocol and deviates from the in-process server instantiation only in specific cases.

See the "Remarks" section here for a description of the algorithm which decides about the context:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms693716(v=vs.85).aspx

0 new messages