Help in Converting Dialog MFC Application to Command Line Application
I have a legacy application that was given to me to convert it to a console application. My only issue is that I'm fairly new to coding in C++ and need any tips/help you can provide.
Currently the MFC application opens 2 files does a calculation and outputs a new file with the calculation in it. The GUI is only used to select which 2 files the user wants to use to do the calculation on.
Basically I want to send arguments via the command line instead of the GUI. Is there a "quick" way of doing this where I can reuse some of the old code without starting writing a new application entirely?
Also, any links that I can read up on would be very much appreciated!
Thanks.
Re: Help in Converting Dialog MFC Application to Command Line Application
It depends on how the MFC app was written. If it was written in a manner that separated the UI from the data/logic then it should be simple to pull that code out and put it into a console app. On the other hand, if the app mixed the data/logic in woth the UI code, it will be harder to extract the non-MFC code.
That being said you could simply add command line parameters to the MFC app and run the app as a console app if parameters are present (or as the MFC dialog app if not).
Re: Help in Converting Dialog MFC Application to Command Line Application
For a console program, the main() function is the entry point to the program and must be present. It takes optional parameters from which you can extract the passed command line arguments. See https://docs.microsoft.com/en-us/cpp...s?view=vs-2019