Almost ..
> I have read a heap of papers, trying to get a grip of this stuff.
>
> To Summaries, just in case I am missing something
> 1 .Create a both threaded object which created a list ( array or
> threadsafe
> TList ?) of created connections, Call this CoCreateFreeThreadedMarshaller
> method
>
I just use a normal dynamic array, but it is only accessed from one method,
that has critical sections present.
The method Hands out a "Connection" object for temporary usage.
You need to return a OleVariant that contains an IDispatch interface.
When you aggregrate the FreeThreader Marshaller, you are saying that your
object does not care on which thread it is called and also does not care
about the COM apartment. It's best to readup on stuff on the MS web site, as
this covers the issues and reasons very well.
procedure TMyApplicationObject.AfterConstruction;
begin
inherited;
OleCheck( CoCreateFreeThreadedMarshaler( Self, FFreeThreadedMarshaler ));
end;
function TMyApplicationObject.ObjQueryInterface(const IID: TGUID; out Obj):
HResult;
begin
if GetInterface(IID, Obj) then Result := S_OK
else Result := FFreeThreadedMarshaler.QueryInterface( IID, Obj );
end;
> 2. Save the object in an Application variable
>
> 3. Each page calls the object created above which returns an available
> interface to the connection ?
>
Basically yes. Although there are other methods. You need to be careful in
which "COM apartment" your connection objects are created to obtain maximum
efficiency.
> I am off to Dallas again, so will have 20hours of traveling to do some
> more
> reading.
>
> Thanks Neil
>
>
> -----Original Message-----
> From: Myles Penlington [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, 16 May 2000 16:02
> To: Multiple recipients of list delphi
> Subject: RE: [DUG]: Thread and ASp
>
>
>
> > I had considered the creating an application connection pool of my own,
> > but
> > then I really do need to control access and was not too sure if I need
> to
> > marshal the interface pointers etc (ie I became confused)
> >
> It is easier than you think.
> No COM will do the correct marshalling for you.
> You just keep an array of objects (actually I keep the COM Interface
> objects). I Check the actual refCount from the IUnknown interface to
> determine if the object/connection with the least load (or free).
>
> The only trick required is to aggregate the COM FreeThreaded Marshaller
> using a call to CoCreateFreeThreadedMarshaller.
>
> Myles.
>
>
> --------------------------------------------------------------------------
> -
> New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> Website: http://www.delphi.org.nz
> --------------------------------------------------------------------------
> -
> New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> Website: http://www.delphi.org.nz
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz