![]() I have done it before starting to write the service. Once you have successfully instantiated the object and tested one of the method calls, its a simple matter to replicate the code inside the service (which is trickier to debug). You may find it useful to write a simple C++ executable rather than a service, to instantiate the COM object in the manner described earlier in this thread. There is no other advice one can offer given the dearth of information. When it stops working, you know you have done something wrong (and you know where to look). Then slowly repopulate it with your code compiling and confirming correct functionality as you go. If you get stuck, then I suggest starting over with a basic ATL service generated by the wizard. So, you have to do what every C++ programmer is familiar with: you have to debug your program. I have tried your solution but still it gives me an error like can't start service on local computer, your service not responding in timely fashion like that something. these returned object i want to assign to the MyInterface2 object. this returns the IDispatch** to the client. For example, i have implemented an method on MyInterface as GetMyInterface2(). and then this interface returns the another interfaces. I just want to create the instance of that interface. ![]() I my COM dll their is one main interface say MyInterface. ![]() IMyInterfacePtr p HRESULT hr = p.CreateInstance (_uuidof ( M圜omObject )) where M圜omObject is the name of the class (check the contents of the tlh file) For example, if the COM dll defines an interface called IMyInterface, then you can use: #import M圜omObject.dll no_namespace. It will create smart pointers that you can use to help with the instantiation of the COM object. ![]() This creates a *.tlh file in the Debug/Release folder. If your COM dll is already defined elsewhere and you want to instantiate it in the ATL service, I would use the #import directive. I was just trying to save you a few steps, since creating a COM class inside an ATL service is performed in exactly the same manner as creating an ATL DLL. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |