aunch COM server from Control Panel Applet (.cpl) (or DLL?)

In the constructor (not FormCreate) of the main form of a D5 appl I launch a local, out-of-process COM sever created in D4.  This all works fine but I'm now
trying to convert the D5 application to a control panel applet - which causes
problems.  The code base for standard application and applet are exactly the same.

Initially I got 'Coinitialize has not been called' errors when trying to
launch the server which I've addressed by calling Coinitialize.  However,
now at the point where I call coMyServer.Create the system just locks up.
If I comment out this code out the applet runs as expected.  There are
definately no issues with the COM server.

Since its a control panel applet its effectively now a type of DLL (.cpl).
Could it be that you can't launch a COM server from a DLL / CPL?  Is there a

Who is Participating?
OpitzSConnect With a Mentor Commented:
Usually not, because you give the Com server a adress room, in which it exists. But a dll can't have that.

Startfrom you cpl a normal exe, that just starts the com-server. but don't forget, when that exe is quit, the com server disappears again, because it is not needed anymore. even Microsoft uses this trick in one case, where the cpl just starts another exe-file.
andrewjacksonAuthor Commented:
Nice solution.  I'd actually given up on this one but am tempted to give it another go now :-)
All Courses

From novice to tech pro — start learning today.