You didn't give me detailed information for what to put the code at...
Oh... I somewhat forgot something...
I have IDs and controls that I have in 2 dialogs:
IDD_OUTPUTTEST_DIALOG : Main dialog
IDC_QUESTION : Static text (What is your name?)
IDC_NAME : Edit box {This is where I type in and send a text to a
new dialog)
IDC_SENDNAME : This button should copy the text and send them to a new dialog {Button: (Send)}
IDOK : (Close) Acts as an OK button...
In MFC ClassWizard:
~Begin...~
Object ID: IDC_NAME
Messages: EN_CHANGE
Member Functions: OnChangeName ON_IDC_NAME EN_CHANGE
(Indicates the display is updated after text changes)
Object ID: IDC_SENDNAME
Messages: BN_CLICKED
Member Functions: OnSendname ON_IDC_SENDNAME BN_CLICKED
(Indicates the user clicked a {left mouse} button)
~End of information in ClassWizard...~
IDD_OUTPUT_TEXT_DLG : This is a dialog box where I get an output from an edit box I've inputted into a edit box and clicked Send
IDC_TEXT_PREFIX : (Hi )
IDC_OUTPUT_NAME : Border turned off; This is where I recieve text that I've typed from edit box in the previous main dialog
IDOK : Return
ClassWizard info I've implemented:
Object IDs: IDC_OUTPUT_NAME
Messages: EN_UPDATE
Member Functions: OnUpdateOutputName ON_IDC_OUTPUT_NAME EN_UPDATE
OK. I put the code in for those 2 files:
One is for outputtestDlg.cpp, though I included Windows.h...:
Code:
void COutputtestDlg::OnChangeName()
{
static char buffer[256];
GetDlgItemText(IDD_OUTPUTTEST_DIALOG,
IDC_NAME,
buffer,
255);
}
void COutputtestDlg::OnSendname()
{
}
Others for outputtextstring.cpp:
Code:
void Outputtextstring::OnUpdateOutputName()
{
extern char buffer;
SetDlgItemText(IDD_OUTPUT_TEXT_DLG,
IDC_NAME,
buffer
);
}
Now I got 2 errors here:
--------------------Configuration: outputtest - Win32 Debug--------------------
Compiling...
outputtestDlg.cpp
C:\Learn\VCPP\outputtest\outputtestDlg.cpp(102) : error C2661: 'GetDlgItemTextA' : no overloaded function takes 4 parameters
Outputtextstring.cpp
C:\Learn\VCPP\outputtest\Outputtextstring.cpp(49) : error C2660: 'SetDlgItemTextA' : function does not take 3 parameters
Generating Code...
Compiling...
outputtest.cpp
Generating Code...
Error executing cl.exe.
outputtest.exe - 2 error(s), 0 warning(s)