Board index » delphi » Confused w/writing OLE Server DLL

Confused w/writing OLE Server DLL

I wrote a DLL in Delphi that serves as a high-level print engine for
printing labels. It works great, allows users to add objects (Text,
barcodes, graphics, etc), rotate them, resize them, print,
save/restore, etc.

I now want to go back and add an OLE Server layer to it, and am
confused. For one thing, Delphi won't let me add a Type Library to the
project since it wasn't created as an "Active Library". I think I can
get around that by backing up my project, creating a new ActiveX
Library, and then adding all my stuff back into it. Right?

Also, since it's an in-proc server, I want the methods to use the same
non-variant data structures that are used when communicating through
direct DLL calls. Is this possible, or do I need to use variants since
there is a type library?

Do I really NEED a type library? I've seen examples of shell-extension
in-prooc servers that doon't have them, and use non-variant
parameters. Is this OK?

I've read Inside OLE, Using Delphi 3, and other sources of
information, and am still confused over the best way to proceed. Any
info, tips, suggestions, feedback, etc would be GREATLY appreciated.

David Block
CoStar Corporation

Check out our label printers at www.costar.com

Email:  dblockREM...@costar.com

 

Re:Confused w/writing OLE Server DLL


Quote
David Block wrote:

> I now want to go back and add an OLE Server layer to it, and am
> confused. For one thing, Delphi won't let me add a Type Library to the
> project since it wasn't created as an "Active Library". I think I can
> get around that by backing up my project, creating a new ActiveX
> Library, and then adding all my stuff back into it. Right?

> Also, since it's an in-proc server, I want the methods to use the same
> non-variant data structures that are used when communicating through
> direct DLL calls. Is this possible, or do I need to use variants since
> there is a type library?

> Do I really NEED a type library? I've seen examples of shell-extension
> in-prooc servers that doon't have them, and use non-variant
> parameters. Is this OK?

If you're going to use all the high-level wrapper functionality that
Delphi provides for COM, you'll need to create an "Active Library"
project, add into it an "Automation Server", and patch in your
functionality. It's really not that hard if your original code was
modularized well.

If you want to use non-Automation data types in the methods of your COM
interface, you've got to write the IDL, compile it using MIDL, build the
proxy/stub DLL from the MIDL-generated '.c' files, and register the
proxy/stub DLL. To get a list of Automation data types, review books
such as Inside COM by Rogerson, Essential COM by Box, and Professional
DCOM Programming by Grimes. Maybe Delphi's Help file contains a list too
but Delphi is 'type-library marshalling' centric.

Type libraries are convenient in that they can register all your
interfaces, CoClasses, etc for you (i.e. Delphi handles this for you),
they use the standard marshalling DLLs (i.e. they use Automation data
types) so you don't need to generate your own, and Delphi provides an
VERY convenient type library editor.

Hope this helps.

Other Threads