Text editor in vc++

Hi everyone!
I need a good tutorial about creating a text editon in vc ++. Actually I need to "send" data in a notepad every time I write double numbers on edit control and press save. I am new and I have no idea. I made an effort and wrote something but my dialog (where the edit control is) don't even open when I run the executable.

If you show us the code we might be able to help.

Here is a tutorial about an editor:
http://www.catch22.net/tuts/neatpad

Here is a editor project
https://github.com/genuinelucifer/mypad

General WinApi tutrials:
http://www.functionx.com/win32/index.htm
http://www.winprog.org/tutorial/controls.html
http://zetcode.com/gui/winapi/
Well I have to write some code here but I don't know. :/

1
2
3
4
5
6
void CInputView::OnLinefeaturesData()
{
	// TODO: Add your command handler code here
	CInputDoc* pDoc = GetDocument();
	CDataDialog DialogWindow;
}


For Button Save I have this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
void CDataDialog::OnBnClickedSave()
{
	// TODO: Add your control notification handler code here
	CFileDialog dlg(FALSE, L"Text Files (*.txt)|*.txt|Texr Files (*.h)|*.h|", NULL, OFN_OVERWRITEPROMPT, L"Text Files (*.txt)|*.txt|Text Files (*.h)|*.h|");

	CStdioFile file;

	CString buffer;
	CString textfile;

	if (dlg.DoModal() == IDOK)
	{
		file.Open(dlg.GetFileName(), CStdioFile::modeCreate | CStdioFile::modeWrite);
		dlg.GetFileName();

		file.WriteString(buffer);

		file.Close();
	}

}


For Edit Box I have this:
1
2
3
4
5
6
7
8
9
10
void CDataDialog::OnEnChangeEdit1()
{
	// TODO:  If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.

	// TODO:  Add your control notification handler code here
	UpdateData(TRUE);
}
Before you can write the buffer to disk you need to get the text from the texcontrol( CEdit?) into your CString buffer;
Thank you for your answer! :) I made these changes but still didn't work:

1
2
3
4
5
6
7
8
9
10
11
12
13
void CDataDialog::OnEnChangeEdit1()
{
	// TODO:  If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.

	// TODO:  Add your control notification handler code here
	//UpdateData(TRUE);
	CString buffer;
	CEdit *pEdit = (CEdit*)GetDlgItem(IDC_EDIT1);
	pEdit->GetWindowText(buffer);
}



1
2
3
4
5
6
7
8
9
10
void CInputView::OnLinefeaturesData()
{
	// TODO: Add your command handler code here
	
	CInputDoc* pDoc = GetDocument();
	CDataDialog DialogWindow;
	
	// Now show the dialog
	DialogWindow.DoModal();
}
1
2
3
CString buffer;
CEdit *pEdit = (CEdit*)GetDlgItem(IDC_EDIT1);
pEdit->GetWindowText(buffer);


This shoud be in void CDataDialog::OnBnClickedSave() before you write the text to the disk.
Topic archived. No new replies allowed.