Board index » delphi » One Automation Client with alternate Automation Servers

One Automation Client with alternate Automation Servers

Hello. I have a simple question (maybe the answer is not so simple... :)

My application has to communicate with a kind of special printer. There are
many suppliers of this special printer using different "protocols". I want
to write different Automation Servers for each one of these suppliers.

I want to have a single ISpecialPrinter interface with methods like
Print_Page_Header.  The different Automation Servers will implement
internally these methods, each one in its way with its proprietary protocol.
The main application's code will use CreateOLEObject() to instantiate an OLE
Object by its name, for example, "Supplier1Server.ISpecialPrinter" or
"Supplier2Server.ISpecialPrinter".

I was able to write the first Automation Server for Supplier #1. Now I would
like to reuse all properties and methods defined in the TLB - more
specifically, the ISpecialPrinter interface - in the Automation Server for
Supplier #2. But it seems that Delphi ties the TLB file and the
automatically generated PAS units to the original project. I wouldn't like
to have to rewrite it all.

What is the best (or right) way to accomplish this?

Thanks in advance,

Andr Ricardo Barreto de Oliveira
Otimiza Consultoria e Sistemas
Brazil

 

Re:One Automation Client with alternate Automation Servers


Hello,

Define a separate TLB that acts as your abstract interface library (no
CoClasses, just interfaces). Include and reuse this type library (and the
interfaces contained in it) for all your servers.

have fun,
--
Binh Ly
Brickhouse Data Systems, Inc.
http://www.brickhouse.com

Quote
Andr de Oliveira wrote in message <71sc9f$e...@forums.borland.com>...
>Hello. I have a simple question (maybe the answer is not so simple... :)

>My application has to communicate with a kind of special printer. There are
>many suppliers of this special printer using different "protocols". I want
>to write different Automation Servers for each one of these suppliers.

>I want to have a single ISpecialPrinter interface with methods like
>Print_Page_Header.  The different Automation Servers will implement
>internally these methods, each one in its way with its proprietary
protocol.
>The main application's code will use CreateOLEObject() to instantiate an
OLE
>Object by its name, for example, "Supplier1Server.ISpecialPrinter" or
>"Supplier2Server.ISpecialPrinter".

>I was able to write the first Automation Server for Supplier #1. Now I
would
>like to reuse all properties and methods defined in the TLB - more
>specifically, the ISpecialPrinter interface - in the Automation Server for
>Supplier #2. But it seems that Delphi ties the TLB file and the
>automatically generated PAS units to the original project. I wouldn't like
>to have to rewrite it all.

>What is the best (or right) way to accomplish this?

>Thanks in advance,

>Andr Ricardo Barreto de Oliveira
>Otimiza Consultoria e Sistemas
>Brazil

Other Threads