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

📄 dlog.cpp

📁 实现智能大厦自动报警系统主要是通过串口通信来实现的。计算机对数模转换设备发送到端口的数据进行处理
💻 CPP
字号:
// DLog.cpp : implementation file
//

#include "stdafx.h"
#include "yhjk.h"
#include "DLog.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#define MAX 999999
/////////////////////////////////////////////////////////////////////////////
// CDLog dialog


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


void CDLog::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDLog)
	DDX_Control(pDX, IDC_EDIT1, m_Edit1);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDLog, CDialog)
	//{{AFX_MSG_MAP(CDLog)
	ON_BN_CLICKED(IDC_BUT_CLEAR, OnButClear)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDLog message handlers

void CDLog::OnOK() 
{
}


BOOL CDLog::OnInitDialog() 
{
	CDialog::OnInitDialog();
	char value[MAX];
	CFile file("zndsjk.LOG",CFile::modeRead);
	file.ReadHuge(value,MAX);
	file.Close();
	CString str;
	str.Format("%s",value);
	int r=0,n=0;
	while(n!=-1)
	{
		r=n;
		n=str.Find("-",n+1);
	}
	str=str.Left(r);
	this->m_Edit1.SetWindowText(str);
		return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CDLog::OnButClear() 
{
	if(MessageBox("确定要删除日志吗?","系统提示",MB_OKCANCEL|MB_ICONQUESTION)!=1)
		return;
	FILE* fp;
	fp=fopen("zndsjk.log","w");
	fprintf(fp,"");
	fclose(fp);
	this->m_Edit1.SetWindowText("");
	
}

⌨️ 快捷键说明

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