Friday, April 18, 2014

ATL Service PreMessageLoop is not Called or ATL Service is cannot be Registered


I had a problem as I mentioned above and I solved in a way as follows

Step 1:-

          Check your Service APPID is registered in HKEY_CLASSES_ROOT

             In this See AppID folder by Expanding it you can see AppID of different Application

         See whether your AppID of ATL service is there

          Your ATL Service AppID is given in the <class>ServiceModule  .cpp file

           It is mentioned along with DECLARE_REGISTRY_APPID_RESOURCEID

         It will look like some thing like this

          DECLARE_REGISTRY_APPID_RESOURCEID(IDR_MYService,"{6F201537-FA02-47DA-B778-A7D5E27CEDF2}")

          this is your AppID for Application see this is registed in Registry

  Run->regedit->HKEY_CLASSES_ROOT->AppID find 6F201537-FA02-47DA-B778-A7D5E27CEDF2

          if this doesnot exists that means your application is not registered and the service fails to start up

Step 2:- To Register service and Make it Startup

            Right Click Visual Studio Icon->Run As Administrator

            Open your ATL project want to register

             Project->Linker->Per-user Redirection set to No (If Project is 2010 and above else Yes)
     
             Project->Linker->Register Output Set to Yes

Now Re-build apllication and run see the ATL service is registed and works fine

No comments:

Post a Comment