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
workaround?


andrewjacksonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

OpitzSCommented:
Usually not, because you give the Com server a adress room, in which it exists. But a dll can't have that.

Workaround:
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.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
andrewjacksonAuthor Commented:
Nice solution.  I'd actually given up on this one but am tempted to give it another go now :-)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.