⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 play.cpp

📁 这是个基于MFC开发的药品打假应用程序
💻 CPP
字号:
// Play.cpp : implementation file
//

#include "stdafx.h"
#include "MyFight.h"
#include "Play.h"
#include "MyFightDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// Play dialog


Play::Play(CWnd* pParent /*=NULL*/)
	: CDialog(Play::IDD, pParent)
{
	//{{AFX_DATA_INIT(Play)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
	m_nItem=0;
}


void Play::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(Play)
	DDX_Control(pDX, IDC_LIST1, m_ListBox);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(Play, CDialog)
	//{{AFX_MSG_MAP(Play)
	ON_BN_CLICKED(IDC_FIGHT, OnFight)
	ON_BN_CLICKED(IDC_START, OnStart)
	ON_BN_CLICKED(IDC_STOP, OnStop)
	ON_BN_CLICKED(IDC_CANCEL, OnCancel)
	ON_WM_TIMER()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// Play message handlers

void Play::OnFight() 
{
	// TODO: Add your control notification handler code here
	
}

void Play::OnStart() 
{
	// TODO: Add your control notification handler code here
	m_idTime=SetTimer(1,2000,0);
	
}

void Play::OnStop() 
{
	// TODO: Add your control notification handler code here
	KillTimer(m_idTime);
	
}

void Play::OnCancel() 
{
	// TODO: Add your control notification handler code here
	CDialog::OnCancel();
	
}

BOOL Play::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	CMyFightDlg dlg;
	
    CString str;
	str=dlg.m_csCurrentPath;
	str+="\\";
	str+="play.csv";


	CStdioFile file;
    file.Open(str,CFile::modeRead );
		
	CString csOutput;
	int i=1;
	m_ListBox.AddString("");
	while(file.ReadString(csOutput))
	{
		if(i==1)
		{}
		else
		{
			
			while(!csOutput.IsEmpty())
			{
				int n=csOutput.Find((char)44);
				if(n==-1) break;
				
				m_ListBox.AddString(csOutput.Left(n));
				
				csOutput=csOutput.Right(csOutput.GetLength()-n-1);
				
			}
			m_ListBox.AddString(" ");
		}
		i++;
		
	}
	file.Close();

	m_idTime=SetTimer(1,2000,0);
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void Play::OnTimer(UINT nIDEvent) 
{
	// TODO: Add your message handler code here and/or call default
	if(m_nItem>=m_ListBox.GetCount())
		m_nItem=0;
	m_ListBox.SetCurSel(m_nItem);
	m_nItem+=15;

	CDialog::OnTimer(nIDEvent);
}

⌨️ 快捷键说明

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