Re: WTL exe acting as COM Server - presume users will latch onto single instance exe
"Angus Comber" <nospam@gmail.com> wrote in message
news:uAU9vjprGHA.4684@TK2MSFTNGP05.phx.gbl
If from a client program, say Visual Basic, I do something like:
Dim xyz As New Angus.Component
xyz.RunFunction(params)
It looks from my testing that the Visual Basic client program DOES
NOT run another instance of the exe? Is this the case?
It may or may not be. You control this by choosing the flag you pass to
CoRegisterClassObject, or CComModule::RegisterClassObjects in an ATL
based project. Read about the difference between REGCLS_SINGLEUSE and
REGCLS_MULTIPLEUSE.
Even though
the client asks for a New instance!
The client is asking for a new instance of the COM object, not
necessarily a new instance of the server. A single server can serve
multiple objects, of the same or different coclasses.
E.g. MS Excel is a COM automation server that represents every
spreadsheet cell as a separate COM object. You don't expect a new
instance of excel.exe to run for each cell, right?
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925