Visual C++ Developer Center > Visual C++ Forums > Visual C++ General > How to migrate Windows-based Service using VC6 and ATL to VC9 (VS2008)?
Ask a questionAsk a question
 

AnswerHow to migrate Windows-based Service using VC6 and ATL to VC9 (VS2008)?

  • Saturday, November 07, 2009 4:25 PMSnowdog25 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    We have a lot windows-based service using VC6 and ATL. They are working many years. Now, we need migrate these Windows-based Service into VS2008. We have also compiled these services (VC6) code into VS2008 successfully. But, we couldn't start up the services. I had some questions:

    1. Is ATL (ATL7?) in VS2008 compatible with ATL in Visual C++ 6.0?
    2. Is the recompilation from VC6 to VC9 good enough for the migration?
    3. Does ATL7 in VS2008 breaks applications that were written using ATL3 (Visual C++ 6.0)?
    4. Do we need to make lots code changes in VC6 code to make it working for VS2008?

     

     

    Thanks.

     

Answers

  • Tuesday, November 10, 2009 2:34 AMWesley YaoMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Can you please confirm that "ATL Service application are different between ATL7 and ATL3".
    If this is the case, then the pure recompilation from VC6 to VC9 is not good enough for the migration, and the VC6 Service application code need to be modified for the migration.

    Yes, the mechanism has been changed, the pure recompilation is not enough for the migration.
    You will need to modify the code or re-write it in VS2008.

    Sincerely,
    Wesley
    Please mark the replies as answers if they help and unmark them if they provide no help. Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked As Answer bySnowdog25 Tuesday, November 10, 2009 3:55 PM
    •  

All Replies

  • Monday, November 09, 2009 10:38 AMWesley YaoMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hello,

    ATL Service application are different between ATL7 and ATL3, ATL7 has rewritten the part of service, this article gives a very nice analysis from each phases, you could start with it to do the migration:
    Migrating ATL service applications to Visual C++.NET

    Hope that helps.

    Sincerely,
    Wesley

    Please mark the replies as answers if they help and unmark them if they provide no help. Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
  • Monday, November 09, 2009 8:20 PMSnowdog25 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hello,

    ATL Service application are different between ATL7 and ATL3, ATL7 has rewritten the part of service, this article gives a very nice analysis from each phases, you could start with it to do the migration:
    Migrating ATL service applications to Visual C++.NET

    Hope that helps.

    Sincerely,
    Wesley

    Please mark the replies as answers if they help and unmark them if they provide no help. Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.

    Hello Wesley,

    Thank you very much for the reply.

    Can you please confirm that "ATL Service application are different between ATL7 and ATL3".
    If this is the case, then the pure recompilation from VC6 to VC9 is not good enough for the migration, and the VC6 Service application code need to be modified for the migration.

    Thank you again for the replay.

    Sincerely,
    Snowdog
     
  • Tuesday, November 10, 2009 2:34 AMWesley YaoMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Can you please confirm that "ATL Service application are different between ATL7 and ATL3".
    If this is the case, then the pure recompilation from VC6 to VC9 is not good enough for the migration, and the VC6 Service application code need to be modified for the migration.

    Yes, the mechanism has been changed, the pure recompilation is not enough for the migration.
    You will need to modify the code or re-write it in VS2008.

    Sincerely,
    Wesley
    Please mark the replies as answers if they help and unmark them if they provide no help. Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked As Answer bySnowdog25 Tuesday, November 10, 2009 3:55 PM
    •  
  • Tuesday, November 10, 2009 3:12 AMBrian MuthMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Snowdog25, I urge you to consider the following approach which has always worked reliably in my hands: Use VS 2008 to create a brand new ATL Server. Also, create the COM objects(s), and define the methods and properties exactly in the same manner as the previous version. Finally copy/paste the guts of the code from the VC6 project to the new project.

    You should end up with a functional implementation of the COM object, however, the CLSID and IID's will all be brand new. If you want to maintain compatibility, change this CLSID's and IID's manually to match those define in the VC6 project.

    • Marked As Answer bySnowdog25 Tuesday, November 10, 2009 3:55 PM
    • Unmarked As Answer bySnowdog25 Tuesday, November 10, 2009 3:55 PM
    •  
  • Tuesday, November 10, 2009 9:04 PMSnowdog25 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Brian,

    Thank you very much for your recommendations. Very good suggestions!!!

     
     

    One more question:

     

    I created an ATL Window Service using VS2008 (w/o adding COM objects yet). Tried to start and stop the Service, everything works fine.

     

    Then I try to add the existing old MFC class(*.h and *.cpp file) into ATL Service project. I got compiler error on using MFC CString, CMutex, and so on…

     

    Then I follow MSFT support article (please see the link: http://support.microsoft.com/kb/181505/EN-US/) to add MFC library into stdafx.h header file. I  got compiler error:

     

    Error     1          error C2504: 'CAtlServiceModuleT' : base class undefined d:\TestSvc\TestSvc\TestSvc\TestSvc.cpp 10            TestSvc

     

      

    Question: does VS2008 ATL Window Service support MFC library? If yes, what did I miss?

     

     

    Many thanks for your recommendations and help!!!

     

    Sincerely,

     

    SnowDog

  • Tuesday, November 10, 2009 9:53 PMBrian MuthMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Microsoft does not support using MFC to build Windows services. It has nothing to do with ATL.