newlistdlg.cpp

来自「实现类似千千静听功能的播放器,采用MFC技术,在VC++6.0SP6中实现」· C++ 代码 · 共 81 行

CPP
81
字号
// NewListDlg.cpp : implementation file
//

#include "stdafx.h"
#include "MyPlayer.h"
#include "NewListDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CNewListDlg dialog


CNewListDlg::CNewListDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CNewListDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CNewListDlg)
	m_strName = _T("");
	//}}AFX_DATA_INIT
}


void CNewListDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CNewListDlg)
	DDX_Text(pDX, IDC_EDIT_NAME, m_strName);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CNewListDlg, CDialog)
	//{{AFX_MSG_MAP(CNewListDlg)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CNewListDlg message handlers

void CNewListDlg::OnCancel() 
{
	// TODO: Add extra cleanup here	
	CDialog::OnCancel();
}

void CNewListDlg::OnOK() 
{
	// TODO: Add extra validation here
	UpdateData();
	if(m_strName.IsEmpty()){
		MessageBox("请输入列表名");
		return;
	}

	CString strFileName;
	int i;
	for(i=0;i<10;i++)
		if(fileList[i].strFileName.IsEmpty())
			break;
	nCurrentList=i;
	strFileName.Format("00%d.lst",i);
	fileList[i].strFileName=strFileName;
	fileList[i].strMenu=m_strName;
	strFileName.Format("%s\\%s",strCurrentDir,strFileName);
	CString strlist;
	strlist.Format("%s\\listname.dat",strCurrentDir);
	ofstream outfile(strlist,ios::app),out(strFileName,ios::out);
	outfile<<fileList[i].strMenu;
	outfile<<"*-*-*-*";
	outfile<<fileList[i].strFileName;
	outfile<<endl;
	outfile.close();
	out.close();

	CDialog::OnOK();
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?