Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Converting MFC apps to .net

Converting MFC apps to .net

Scheduled Pinned Locked Moved Visual Basic
c++csharpcomtools
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Fu Manchu
    wrote on last edited by
    #1

    Hi all, I have tried posting the dedicates subjects, but it seems that knowone has the knowledge or just so obnoxious they dont care for any other language and as soon as you mention VB or .net well thats it....see u later Out of all the .net languages i prefer VB.net, its just easier to work with. So does anyone in here know anything about MFC apps, first i would like to convert an MFC windows app to a MFC console app and then wrap it in MC++ with the #pragma umanaged and #prama managed blocks. Once i have this working i can create a .net DLL, instead of the console app, this DLL with import straight into a VB.net application and allow me to leverage the COM method within the API and also have the .net functionality. I explain this because, i would not expect every VB coder to understand this but someone with C++/MC++ should understand without thinking.......NOT! http://www.codeproject.com/script/Forums/View.aspx?fid=3785&msg=2565053[^] All i'm asking here is what i need to do you make the existing MFC app, that has windows etc.., into a console app - like a DOS prompt. Thanks

    G 1 Reply Last reply
    0
    • F Fu Manchu

      Hi all, I have tried posting the dedicates subjects, but it seems that knowone has the knowledge or just so obnoxious they dont care for any other language and as soon as you mention VB or .net well thats it....see u later Out of all the .net languages i prefer VB.net, its just easier to work with. So does anyone in here know anything about MFC apps, first i would like to convert an MFC windows app to a MFC console app and then wrap it in MC++ with the #pragma umanaged and #prama managed blocks. Once i have this working i can create a .net DLL, instead of the console app, this DLL with import straight into a VB.net application and allow me to leverage the COM method within the API and also have the .net functionality. I explain this because, i would not expect every VB coder to understand this but someone with C++/MC++ should understand without thinking.......NOT! http://www.codeproject.com/script/Forums/View.aspx?fid=3785&msg=2565053[^] All i'm asking here is what i need to do you make the existing MFC app, that has windows etc.., into a console app - like a DOS prompt. Thanks

      G Offline
      G Offline
      Garth J Lancaster
      wrote on last edited by
      #2

      you're talking about a significant amount of effort - it doesnt even translate 1 for 1 - it depends on lots of things eg how much input is coming from the dialog etc if the MFC app is using a dialog for input .. while I dont agree of the way you've treated 'led mike' or your 'just so obnoxious' comment, Id start like this ... 1) Ascertain all the dialog inputs from the MFC program - maybe design an XML file or such that will be read by the console program, and feed it as an argument on the command line 2) Look at all the calculation logic in the MFC program - it could be spread across all sorts of classes/locations. If you have discrete classes, single them out for inclusion into the console program, else bundle all the code etc, think about where in the console prog it will sit/be accessed - under main() for instance 3) any output from the MFC that went to a listbox for example, and the results of your calculations can be output to cout, cerr etc using iostreams but I suspect you'll already have thought of all that 'g'

      F 1 Reply Last reply
      0
      • G Garth J Lancaster

        you're talking about a significant amount of effort - it doesnt even translate 1 for 1 - it depends on lots of things eg how much input is coming from the dialog etc if the MFC app is using a dialog for input .. while I dont agree of the way you've treated 'led mike' or your 'just so obnoxious' comment, Id start like this ... 1) Ascertain all the dialog inputs from the MFC program - maybe design an XML file or such that will be read by the console program, and feed it as an argument on the command line 2) Look at all the calculation logic in the MFC program - it could be spread across all sorts of classes/locations. If you have discrete classes, single them out for inclusion into the console program, else bundle all the code etc, think about where in the console prog it will sit/be accessed - under main() for instance 3) any output from the MFC that went to a listbox for example, and the results of your calculations can be output to cout, cerr etc using iostreams but I suspect you'll already have thought of all that 'g'

        F Offline
        F Offline
        Fu Manchu
        wrote on last edited by
        #3

        The application uses an API to access the currency exchange, the application was design by the company that allows this access - and by modern stardards is not very good. this app is pretty simple, by this i mean its just got one menu and about 6 items in the menu, when selected by the user the API writes the info to a log window, and like you say my plan was to capture this in a console window with cout etc... yes your right about the classes being spread about, this is the MFC stuff which is why i've included the the MFC classes in the console application. my question here would be this, is there any difference in solution settings from an MFC app to a console app. By this a mean what tells the compiler to run if you comment all the code in the MFC app and paste the code from a console app it will not run! andy

        G 1 Reply Last reply
        0
        • F Fu Manchu

          The application uses an API to access the currency exchange, the application was design by the company that allows this access - and by modern stardards is not very good. this app is pretty simple, by this i mean its just got one menu and about 6 items in the menu, when selected by the user the API writes the info to a log window, and like you say my plan was to capture this in a console window with cout etc... yes your right about the classes being spread about, this is the MFC stuff which is why i've included the the MFC classes in the console application. my question here would be this, is there any difference in solution settings from an MFC app to a console app. By this a mean what tells the compiler to run if you comment all the code in the MFC app and paste the code from a console app it will not run! andy

          G Offline
          G Offline
          Garth J Lancaster
          wrote on last edited by
          #4

          Fu Manchu wrote:

          is there any difference in solution settings from an MFC app to a console app

          I would have thought, heaps, plus the non-inclusion of the MFC code libs/dlls etc - you could check by generating two projects, one MFC, one console, and comparing their make files. "In general" I have added MFC support to a console app - for CString etc, but the dialog stuff (for example) yeesh, not game to try it, although I have seen others do it with a wrapper or two (add a dialog or such) thats why I think you'll only be porting the calc/logic to your console program, the rest - toast !! (once you have all the logic/calcs isolated, you could almost go to a dll anyway couldnt you ?) 'g'

          F 1 Reply Last reply
          0
          • G Garth J Lancaster

            Fu Manchu wrote:

            is there any difference in solution settings from an MFC app to a console app

            I would have thought, heaps, plus the non-inclusion of the MFC code libs/dlls etc - you could check by generating two projects, one MFC, one console, and comparing their make files. "In general" I have added MFC support to a console app - for CString etc, but the dialog stuff (for example) yeesh, not game to try it, although I have seen others do it with a wrapper or two (add a dialog or such) thats why I think you'll only be porting the calc/logic to your console program, the rest - toast !! (once you have all the logic/calcs isolated, you could almost go to a dll anyway couldnt you ?) 'g'

            F Offline
            F Offline
            Fu Manchu
            wrote on last edited by
            #5

            sorry, that exactly what i'm doing i dont care for the windows stuff and dialogs - i'm just trying to get the business logic end that connects to the API - the rest can be done in .net so you reckon its possible, basically i just want to have a class C++ that i can wrap in MC++. i would call the method etc from .net and get the returned data.

            G 1 Reply Last reply
            0
            • F Fu Manchu

              sorry, that exactly what i'm doing i dont care for the windows stuff and dialogs - i'm just trying to get the business logic end that connects to the API - the rest can be done in .net so you reckon its possible, basically i just want to have a class C++ that i can wrap in MC++. i would call the method etc from .net and get the returned data.

              G Offline
              G Offline
              Garth J Lancaster
              wrote on last edited by
              #6

              yeah - if you factor the class so that it has a setup/init stage where you feed it paras etc then a do_it() method that returns the result or a seperate get_result() method, then you're in good stead 'g'

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups