济南做门户网站开发公司市场调研方案
承接专栏《MFC工控项目实例二十五多媒体定时计时器》
 用选取的型号为文件名建立文件夹,再在下面用测试的当天的时间创建文件夹,在这个文件中用测试的时/分/秒为数据库名创建Adcess数据库。
 1、在StdAfx.h文件最下面添加代码
#import "C:/Program Files/Common Files/system/ado/msadox.dll"  rename_namespace("ADOX")//创建数据库
#import "c:/program files/common files/system/ado/msado15.dll"  no_namespace  rename ("EOF", "adoEOF")  
2、在SEAL_PRESSUREDlg.h文件中添加代码
#include "shlwapi.h"
#pragma comment(lib,"shlwapi.lib")`class CSEAL_PRESSUREDlg : public CDialog
{
public:CSEAL_PRESSUREDlg(CWnd* pParent = NULL);	// standard constructor
public:
_ConnectionPtr m_pConnection;
_RecordsetPtr m_pRecordset;void cre_data(void);
...
}	
 
3、在SEAL_PRESSUREDlg.cpp文件中添加代码
BOOL CSEAL_PRESSUREDlg::OnInitDialog()
{CDialog::OnInitDialog();m_TES_START.EnableWindow (0);CWinApp* pApp = AfxGetApp();int i=  pApp->GetProfileInt("参数","nProductSel1",0);if (i!=0){CString str = theApp.m_allPara[i].m_strTypeName;if (!PathIsDirectory(str)){SetDlgItemText(IDC_STATIC_TYPNAME,str);m_TES_START.EnableWindow (1);theApp.typ_name=theApp.m_DataPath+str+"\\";CreateDirectory(theApp.typ_name,FALSE);SYSTEMTIME SystemTime;::GetLocalTime(&SystemTime);CString str1="",Date="";str1.Format("%02d",SystemTime.wYear);Date = Date + str1;str1.Format("_%02d",SystemTime.wMonth);Date = Date + str1;str1.Format("_%02d",SystemTime.wDay);Date = Date + str1;
//	str1.Format("_%02d",SystemTime.wHour);
//	Date = Date + str1;
//	str.Format("_%02d",SystemTime.wMinute);
//	Date = Date + str1;
//	str.Format("_%02d",SystemTime.wSecond);
//	Date = Date + str1;     theApp.time_name=theApp.typ_name+Date+"\\";CreateDirectory(theApp.time_name, FALSE);SetDlgItemText(IDC_STATIC99,theApp.time_name);cre_data();}}void CSEAL_PRESSUREDlg::OnTesStart() 
{if (m_isStop){m_TES_START.SetIcon(IDI_TES_START); m_TES_START.SetAlign(CButtonST::ST_ALIGN_VERT);((CButton *)GetDlgItem(IDC_TES_START))->SetWindowText(m_isStop ? "结束测试" : "开始测试");	DestroyTimer();m_isStop=0;}else{ t_time=0;m_TES_START.SetIcon(IDI_TES_STOP); m_TES_START.SetAlign(CButtonST::ST_ALIGN_VERT);((CButton *)GetDlgItem(IDC_TES_START))->SetWindowText(m_isStop ? "结束测试" : "开始测试");	CreateTimer();	CTime m_time; 		m_time=CTime::GetCurrentTime();             //获取当前时间日期// CString   m_strDateTime=m_time.Format(_T("%Y-%m-%d %H:%M:%S %A"));   //格式化日期时间CString   str=m_time.Format("%Y_%m_%d ");   //格式化日期时间theApp.time_name=theApp.typ_name+"\\"+str+"\\";CreateDirectory(theApp.time_name, FALSE);//	cre_data();m_isStop=1;} 
运行程序
 
