OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Re: Single use option in .NET 2002?

From: Qiang Yu (qiangyuGMAIL.COM)
Date: Fri Apr 29 2005 - 06:33:54 CDT


Hi Scott,
To my knowledge, the 4th parameter is not to control singleton. In Don's
book, it says
"
The former (REGCLS_SINGLEUSE) tells the COM library to use a class object to
service only one activation request...If a second activation request is
made, COM ..will create another server process to satisfy the request
"

I think this means one exe can only serve one clinet but that might not be
what Paul wants. I am not sure whether my understanding is correct or not
because I have not used this flag before.

If Paul is using ATL, I think Peter's solution would be correct, using
DECLARE_CLASSFACTORY_SINGLETON. :)

Thanks!

Qiang

On 4/28/05, Scott Butler <butler.scotttangoinc.com> wrote:
>
> Paul,
>
> It has been a while since I looked at this, but here is how you do it in
> Vanilla COM. When the exe starts up, it calls the API
> CoRegisterClassObject. The 4th parameter controls what you want. Usually,
> people use REGCLS_MULTIPLEUSE which lets many clients create objects in
> this
> exe. If you want only one client to use this, use the flag
> REGCLS_SINGLEUSE. Then, your next client will get a new version of the exe
> and an object in that exe.
>
> HTH-
>
> Scott Butler
> President
> Tango Enterprises, Inc.
> 11150 Sunset Hills Rd.
> Suite 250
> Reston, VA 20190
> Phone - (703) 964-4000 x111
> Fax - (703) 964-4600
> butler.scotttangoinc.com
> http://www.tangoinc.com
>
>
> ----- Original Message -----
> From: "Paul Schauble" <Paul.SchaubleTICKETMASTER.COM>
> To: <DCOMDISCUSS.MICROSOFT.COM>
> Sent: Thursday, April 28, 2005 2:41 PM
> Subject: Re: Single use option in .NET 2002?
>
> > I'm not sure that's what I need. If I understand correctly, a singleton
> > will
> > create one object, then every other client that creates an object will
> get
> > a
> > reference to that one. What I want is that the first client will start
> the
> > exe server and create an object. The second client will start another
> copy
> > of the exe and create an object, and so on.
> >
> > ++PLS
> >
> >
> > -----Original Message-----
> > From: Distributed COM-Based Code [mailto:DCOMDISCUSS.MICROSOFT.COM] On
> > Behalf Of Peter Ritchie
> > Sent: Monday, April 25, 2005 9:54 PM
> > To: DCOMDISCUSS.MICROSOFT.COM
> > Subject: Re: Single use option in .NET 2002?
> >
> > Sounds like you're looking for a singleton?
> >
> > If you change your factory (DECLARE_CLASSFACTORY?) to singleton factory
> > (DECLARE_CLASSFACTORY_SINGLETON) you should get what you want.
> >
> > -- Peter
> > http://www.peterRitchie.com/
> >
> > On Mon, 25 Apr 2005 16:36:37 -0700, Paul Schauble
> > <Paul.SchaubleTICKETMASTER.COM> wrote:
> >
> >>I'm writing an EXE resident COM server using ATL7 and .NET 2002.
> >>
> >>I need this to be a single use server. That is, each instance of the
> >>exe will create only one object and will exit when that object is
> >>released.
> >>
> >>Where do I set this option with the above software combination?
> >>
> >
> > ----------------------------------------------------------------
> > Users Guide http://discuss.microsoft.com/archives/mailfaq.html
> > contains important info. Save time, search the archives at
> > http://discuss.microsoft.com/archives/index.html .
> > To unsubscribe, mailto:DCOM-signoff-requestDISCUSS.MICROSOFT.COM
> >
> > ----------------------------------------------------------------
> > Users Guide http://discuss.microsoft.com/archives/mailfaq.html
> > contains important info. Save time, search the archives at
> > http://discuss.microsoft.com/archives/index.html .
> > To unsubscribe, mailto:DCOM-signoff-requestDISCUSS.MICROSOFT.COM
> >
>
> ----------------------------------------------------------------
> Users Guide http://discuss.microsoft.com/archives/mailfaq.html
> contains important info. Save time, search the archives at
> http://discuss.microsoft.com/archives/index.html .
> To unsubscribe, mailto:DCOM-signoff-requestDISCUSS.MICROSOFT.COM
>

--
http://www.activejoy.com

----------------------------------------------------------------
Users Guide http://discuss.microsoft.com/archives/mailfaq.html
contains important info. Save time, search the archives at
http://discuss.microsoft.com/archives/index.html .
To unsubscribe, mailto:DCOM-signoff-requestDISCUSS.MICROSOFT.COM