I would ultimately like to create a simple dialog-based app that does a simple calculation, like adding 1+1, and displays the result in a text box. The caveat is, that I would like the calculation performed in a separate .cpp file (Functions.cpp) so that I can isolate the calculation part of the program from everything else. So, I did the following:
1. Created an MFC dialog-based application in VS2008 called "FirstApp". The files FirstApp.cpp and FirstAppDlg.cpp were created (along with their respective header files).
2. Using the Resource View tab, I inserted a button dialog called IDC_BUTTON1. This is the button to be pushed.
3. Then I Inserted an edit control dialog called IDC_EDIT1. This is where the results of 1+1 is to be displayed. Added a variable (value) called m_strEdit1 of type String to the control.
4. I created Functions.cpp and Functions.h (no code in there yet)
5. Double clicked on the button dialog and inserted the code below
Question: How do make it so that I when I click on Button1 the program goes to Function.cpp to calculate 1+1..and then displays the result "2" in the Edit Control?
UpdateData( TRUE ); // get text from edit control into 'm_strEdit1'
// modify 'm_strEdit1' here just for testing
m_strEdit1 = "2";
UpdateData( FALSE ); // put the text from 'm_strEdit1' to the edit control