2

In Delphi the process of adding an activex object to a project is fairly simple - you import the class and Delphi wraps handlers around it and you're done in seconds. What I'm wanting to do though is create a server that the class connects to rather than a client for the class.

The specific case I'm working on is with OPOS printer drivers. I want to add an OPOS printer driver interface to an existing program so that the OPOS control objects can see my program as just another printer object class. I can readily import the printer type library as a component that I'm a client of, but I'm unsure what I need to do to be the other side of that conversation. I suspect I'm looking at something the wrong way but pretty much all the reference material I've found assumes I want to be a client or that I want to define an entirely new server. I'm also a COM newbie so it's a little confusing. I've been playing with XE and D7, and have created a tlb as per the printer control but obviously haven't quite been able to get it to fly.

Can anyone give me a nudge in the right direction here?

Terry
  • 274
  • 1
  • 4
  • 16
  • I think I have an interface that OPOS is basically happy with, but the driver service object (an out of process server) can't use it. The client app starts, tries to open the server (which does in fact start) but it then hangs for 2 minutes then shuts down with an error about failing to invoke the OPOS server. Specifically, CoCreateProcess fails with this error .. #define CO_E_SERVER_EXEC_FAILURE _HRESULT_TYPEDEF_(0x80080005L) – Terry Aug 01 '11 at 03:51
  • btw ... I'm just trying to build a very basic shell app that will load but nothing more. All the methods are empty. – Terry Aug 01 '11 at 04:05
  • Could you show us the code for your COM server. Also, it's kind of hard to write COM servers without really knowing COM. You may want to read up on the subject. Don Box's Essential COM is my preferred COM reference. – David Heffernan Aug 01 '11 at 08:03
  • @David I can see there is quite a bit to COM, and I'm doing my best to absorb it. In this particular application I just need to build a fairly thin interface between the COM world and the Delphi app, so hopefully it's not insurmountable. – Terry Aug 01 '11 at 12:32
  • I have determined one problem ... if you have a dispinterface defined but unimplemented it seems to silently stop the com object registering. Found a few tips on this thread ... http://stackoverflow.com/questions/1076068/implement-opos-device-in-c ... looks like I've got some reading (and screaming/weeping) to do. – Terry Aug 01 '11 at 13:20

0 Answers0