The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

jvshore (2) [Avatar] Offline
#1
I have created a WCF service (nt service) using C++/CLI. Basically I am having clients pass an xml string to the service, which identifies the object and method of an ATL component. All of the ATL components expose the same interface (call it IGeneric), which derives from IDispatch. When the service retrieves the xml string from the client, it loads the specific component and calls the specified method on the component, using a process similar to scripting clients via dispid. First of all, is this possible in C++/CLI, and if so, how do I load a IDispatch interface from an external ATL component and call its method via its dispid, as scripting client do (.asp -> atl component)?
Nish (16) [Avatar] Offline
#2
Re: Loading IDispatch interface of ATL component from WCF service
Hello JvShore

What you are trying to do has nothing specifically to do with C++/CLI. You can do what you'd do with regular unmanaged C++. Use CoCreateInstance and then once you have the IDispatch, use Invoke passing the dispid of the method you are attempting to invoke.