Click to See Complete Forum and Search --> : A COM component as a service


Matt Johnson
May 20th, 1999, 03:18 PM
I've used the ATL COM wizard of VC++ 5.0 to create a COM server that runs as a service.

The service is able to install and it runs when I try to retrieve an interface. The problem I'm having is that when I use CoCreateInstance to create
an instance of the interface, it returns with the error "Bad variable type."

I've created this server as both a DLL and a non-service EXE. Leaving the client unchanged, CoCreateInstance does not throw an error when using the other two versions. It only errors when the EXE is installed as a service.

Any insight into this problem would be appriciated.

Thanks,
Matt Johnson

Mark O'Sullivan
May 20th, 1999, 05:35 PM
Check that you have built and registered the proxy dll.
To use the server from a remote client, you need to use CoCreateInstanceEx.
You need to fill out a COSERVERINFO structure, to let DCOM know where to find this server and what security authentication you are going to use.
Hope this helps.

MOS