locked
How do I uplift from VC 10 (MFC) to WinRT C++/CX(XAML) Application?

    Question

  • Hello Everyone,

    As of Now we have legacy MFC Win32 Applications which we wanted to uplift with same business logic but with a new UI  (XAML) how can we do we do that ?

    I am expecting

    1)How to uplift projects that are MFC to C++\CX projects?

    2)How is code level transition possible?

    Thanks,


    $Kracker


    • Edited by SKracker Friday, October 18, 2013 10:26 AM
    Friday, October 18, 2013 10:25 AM

Answers

  • Since MFC API is not supported in WinRT, you may have to do a code analysis of your MFC application to abstract the business logic non-MFC code and throw away the rest, and then rewrite the UI with XAML. If your app involves heavy graphics rendering, the "DirectX App (XAML)" project template is the best choice.
    • Marked as answer by SKracker Monday, October 21, 2013 10:38 AM
    Friday, October 18, 2013 1:03 PM
  • Since your app is written in MFC, there is no point to use C#.

    I am afraid there is no easy way to replace MFC with XAML. You may have to rewrite your app, that is, redesign the UI layout, dialogs, and event handlers. The bright side is that you can reuse a good portion of existing C++ code and XAML is much easier to learn than MFC.

    • Marked as answer by SKracker Monday, October 21, 2013 10:39 AM
    Saturday, October 19, 2013 1:17 PM

All replies

  • Since MFC API is not supported in WinRT, you may have to do a code analysis of your MFC application to abstract the business logic non-MFC code and throw away the rest, and then rewrite the UI with XAML. If your app involves heavy graphics rendering, the "DirectX App (XAML)" project template is the best choice.
    • Marked as answer by SKracker Monday, October 21, 2013 10:38 AM
    Friday, October 18, 2013 1:03 PM
  • oh Thanks Leonard,

    We have business logic written in MFC DLL's can't we just  build them in Visual Studio 2013 and add reference for our Windows RT project, is that a possibility? how else should we tweak our project to make it compatible?

    it'd be great if I could get some links that talk about this kind of uplift or experiences

    Thanks,

    Sreekanth B


    $Kracker

    Friday, October 18, 2013 5:39 PM
  • MFC is not available for Windows Store apps. Windows Store apps can use a subset of Win32 and an MFC DLL cannot be simply tweaked to make it work. See Win32 and COM APIs for a list of the available API.

    If your business logic is abstracted from MFC and Win32 and not directly dependant on those then it shouldn't be too hard to convert.

    --Rob

    Friday, October 18, 2013 7:34 PM
    Owner
  • and how could that be are there any references links that I can study? it would be great if we have a case study or a implementation best practices and failure points and pits that we should be careful of ?

    $Kracker

    Friday, October 18, 2013 7:47 PM
  • I'm not aware of anything specific to MFC, but take a look at the Resources for other platform developers .

    --Rob

    Friday, October 18, 2013 7:49 PM
    Owner
  • If you aren't using graphics then I would recommend C#.

    C# is much easier to deal with and debug.

    I have written in c++ and c# and found c++ dire to debug at times.

    I only use c++ if I am heavily using graphics that need to be high speed.


    n.Wright

    Friday, October 18, 2013 8:29 PM
  • Hi Wright,

    Thanks for the C# Suggestion but thing is we already have MFC C++ so we thought

    can't we make use same business Logic(C++ code) for our UI enhancement ?

    then next question came to our minds , how do we eliminate MFC and replace with XAML then?

    Thanks,
    Sreekanth B


    $Kracker


    • Edited by SKracker Friday, October 18, 2013 8:54 PM
    Friday, October 18, 2013 8:53 PM
  • The MFC code is quite different from the Windows8 code for graphics.

    C# is close to c++ so its just a matter of going through your code and altering the bits that wont compile.

    I did a big change from Delphi to C# and it was just a matter of dealing with the differences as the code was copied across and updated.


    n.Wright


    Friday, October 18, 2013 8:57 PM
  • Thanks,

    So could we just create a win32 application and could be deployed in right?

    that mean:-We can use same old DLL for our XAML win32 app right?


    $Kracker

    Saturday, October 19, 2013 8:20 AM
  • Since your app is written in MFC, there is no point to use C#.

    I am afraid there is no easy way to replace MFC with XAML. You may have to rewrite your app, that is, redesign the UI layout, dialogs, and event handlers. The bright side is that you can reuse a good portion of existing C++ code and XAML is much easier to learn than MFC.

    • Marked as answer by SKracker Monday, October 21, 2013 10:39 AM
    Saturday, October 19, 2013 1:17 PM
  • Hmmm I agree with you

    as it is MFC so we have to focus on Win32 application and not on Win RT right?

    so that same MFC dll references can be used for our XAML win32 application right?

    Thanks,

    Sreekanth B


    $Kracker

    Saturday, October 19, 2013 5:38 PM
  • Hmmm I agree with you

    as it is MFC so we have to focus on Win32 application and not on Win RT right?

    so that same MFC dll references can be used for our XAML win32 application right?

    Thanks,

    Sreekanth B


    $Kracker

    1, yes

    2, MFC dll references can NOT be used in XAML app

    Sunday, October 20, 2013 2:27 AM
  • Thanks leonard,

    it was really eye-opening thing for me, when I heard C++ XAML app is compatible in Win 8, I simply presumed it might work if we use our old MFC dll's, turns out to be different story, hopefully I might create a new blog explaining how difficult was it to upgrade our project from MFC win32 app to win store app.

    yet it's making me think "are there anyone out there who might have tried my method of upgradation? and aren't there any other better way of doing it?"

    Thanks,

    Sreekanth B


    $Kracker

    Monday, October 21, 2013 10:48 AM