Seems that i have found out the problem.. I replaced CLSCTX_INPROC_SERVER with CLSCTX_LOCAL_SERVER in CoCreateInstance(). But now i am facing a different problem. I have defined a method in my interface as. STDMETHODIMP CFirst_ATL::AddNumbers(LONG x, LONG y, LONG* z) { *z = x + y; return S_OK; } when i try calling this method from client as hr = IFirst_ATL->AddNumbers(5, 7, &ReturnValue); the method returns S_OK, but the value in ReturnValue is some garbage value. Can anyone please advice where have i went wrong? Thanks!
Janma
Posts
-
ATL COM Service -
ATL COM ServiceI have succeded in creating a service with a dummy interface.... Then in the client I have imported the header file of the service and defined the GUID's. Suppose i have an interface IFirst_ATL and it has a method addnumbers(), then how can i access that method. I am trying to create an instance of the service by hr = CoCreateInstance( CLSID_First_ATL, NULL, CLSCTX_INPROC_SERVER, IID_IFirst_ATL, (void**) &IFirst_ATL); IFirstATL->AddNumbers(5, 7, &ReturnValue); but this is not giving me the desired results. Can you please provide me a sample and successfully running code for accessing the methods of the service? Thanks in Advance!
-
ATL COM ServiceCan anyone please help me or give me some sample code? I need to create an ATL COM service (not a DLL) which has a dummy interface.. say. add 2 numbers.. After creating the service, i want to register it as a windows service. Then i want to create a client which connects to this service and uses the interface.. (adds 2 numbers) I have searched online and there is not a decent article which explains the process step by step... Any help in this regard will be very useful. Thanks in advance!!!!
-
COM DLL Server helpCan anyone please help me or give me some sample code? I need to create an ATL COM service (not a DLL) which has a dummy interface.. say. add 2 numbers.. After creating the service, i want to register it as a windows service. Then i want to create a client which connects to this service and uses the interface.. (adds 2 numbers) I have searched online and there is not a decent article which explains the process step by step... Any help in this regard will be very useful. Thanks in advance!!!!
-
ATL COM ServiceCan anyone please help me or give me some sample code? I need to create an ATL COM service which has a dummy interface.. say. add 2 numbers.. After creating the service, i want to register it as a windows service. Then i want to create a client which connects to this service and uses the interface.. (adds 2 numbers) I have searched online and there is not a decent article which explains the process step by step... Any help in this regard will be very useful. Thanks in advance!!!!