home *** CD-ROM | disk | FTP | other *** search
- // mydlg.cpp : implementation file
- //
-
- #include "stdafx.h"
- #include "fileit.h"
- #include "mydlg.h"
-
- #ifdef _DEBUG
- #undef THIS_FILE
- static char BASED_CODE THIS_FILE[] = __FILE__;
- #endif
-
- /////////////////////////////////////////////////////////////////////////////
- // CMyDlg dialog
-
-
- CMyDlg::CMyDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CMyDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CMyDlg)
- m_EditBoxContents = "";
- //}}AFX_DATA_INIT
- }
-
- void CMyDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CMyDlg)
- DDX_Text(pDX, IDC_EDIT1, m_EditBoxContents);
- //}}AFX_DATA_MAP
- }
-
- BEGIN_MESSAGE_MAP(CMyDlg, CDialog)
- //{{AFX_MSG_MAP(CMyDlg)
- ON_BN_CLICKED(IDC_SAVE_IT, OnSaveIt)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
-
- /////////////////////////////////////////////////////////////////////////////
- // CMyDlg message handlers
-
- void CMyDlg::OnSaveIt()
- {
- // TODO: Add your control notification handler code here
-
- //////////////////////
- // MY CODE STARTS HERE
- //////////////////////
-
- // Create an object TheFile of class CFile
- CFile TheFile;
-
- // Prepare the file for creation OR writing
- TheFile.Open ( "MyFile.TXT",
- CFile::modeCreate|CFile::modeWrite );
-
-
- // Update the value of m_EditBoxContents
- UpdateData (TRUE);
-
- // Write into the TheFile
- TheFile.Write ( m_EditBoxContents,
- m_EditBoxContents.GetLength() );
-
- // Close the file
- TheFile.Close();
-
- ////////////////////
- // MY CODE ENDS HERE
- ////////////////////
-
- }
-