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

📄 find.cpp

📁 开发的,食物管理软件,可以在智能家电的终端上直接应用
💻 CPP
字号:
// Find.cpp : implementation file
//

#include "stdafx.h"
#include "FoodMenu.h"
#include "Find.h"
#include "ColorButton.h"

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

/////////////////////////////////////////////////////////////////////////////
// CFind dialog


CFind::CFind(CWnd* pParent /*=NULL*/)
: CDialog(CFind::IDD, pParent)
{
	//{{AFX_DATA_INIT(CFind)
	//}}AFX_DATA_INIT
}


void CFind::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CFind)
	DDX_Control(pDX, IDC_COMBO1, m_ComboBox);
	DDX_Control(pDX, IDC_BUTTON1, m_ShowContent);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CFind, CDialog)
//{{AFX_MSG_MAP(CFind)
ON_BN_CLICKED(IDC_HOME, OnHome)
ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
	ON_BN_CLICKED(IDC_return, Onreturn)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CFind message handlers

void CFind::OnHome() 
{
	CDialog::OnOK();
	DestroyWindow();
}

BOOL CFind::OnInitDialog() 
{
	CDialog::OnInitDialog();
	home.LoadBitmaps(IDB_home);
	VERIFY(home.SubclassDlgItem(IDC_HOME, this));
	home.SizeToContent();
	
	back.LoadBitmaps(IDB_return);
	VERIFY(back.SubclassDlgItem(IDC_return, this));
	back.SizeToContent();
	for(int i=0;i<countfile;i++)
		m_ComboBox.AddString(Alarmfile[i]);
	m_ComboBox.SetCurSel(-1);
	// TODO: Add extra initialization here
	
	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}

void CFind::OnSelchangeCombo1() 
{
	CString AlarmfilePath=TEXT("\\Storage Card\\foodMenuData\\食物管理\\Add\\");
	CString filename;
	CString txtname;
	CString filetext;//查找的食物内容
	int nIndex ;
	nIndex = m_ComboBox.GetCurSel();
	m_ComboBox.GetLBText(nIndex,filename);
	txtname=filename+TEXT(".txt");
	///////////按路径查找食物内容///////////////
	CFile file;
	char *pBuf;//用于存储文件
	file.Open(AlarmfilePath+txtname,CFile::modeRead);////
	DWORD dwFileLen;
	dwFileLen=file.GetLength();
	pBuf=new char[dwFileLen+1];
	file.Read(pBuf,dwFileLen);
	filetext=pBuf;
	GetDlgItem(IDC_BUTTON1)->SetWindowText(filetext);
	UpdateData(false);
	file.Close();
	delete pBuf;   	
}

		

void CFind::Onreturn() 
{
	CDialog::OnOK();
	DestroyWindow();
}

⌨️ 快捷键说明

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