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

📄 setautorundlg.cpp

📁 服务端: 这是一个完整的基于Wince 4.1图形图象,网络通讯(C/S)模式下的商用程序源代码包.
💻 CPP
字号:
// SetAutoRunDlg.cpp : implementation file
//

#include "stdafx.h"
#include "PPPServer.h"
#include "SetAutoRunDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern SYSTEM_PARAMETER m_system_para;
extern CString m_ini_pathname;
/////////////////////////////////////////////////////////////////////////////
// CSetAutoRunDlg dialog


CSetAutoRunDlg::CSetAutoRunDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CSetAutoRunDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CSetAutoRunDlg)
	m_autorun_flag = FALSE;
	m_save_pathname = _T("");
	m_autorun_tabfilename = _T("");
	//}}AFX_DATA_INIT
}


void CSetAutoRunDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CSetAutoRunDlg)
	DDX_Control(pDX, IDC_DATETIMEPICKER, m_datetimectrl);
	DDX_Check(pDX, IDC_AUTORUN_CHECK, m_autorun_flag);
	DDX_Text(pDX, IDC_SAVEPATHNAME_EDIT, m_save_pathname);
	DDX_Text(pDX, IDC_AUTORUN_TABFILE_EDIT, m_autorun_tabfilename);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CSetAutoRunDlg, CDialog)
	//{{AFX_MSG_MAP(CSetAutoRunDlg)
	ON_BN_CLICKED(IDC_AUTORUNSAVE_BUTTON, OnAutorunsaveButton)
	ON_BN_CLICKED(IDC_OK_BUTTON, OnOkButton)
	ON_BN_CLICKED(IDC_OPENTAB_BUTTON, OnOpentabButton)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSetAutoRunDlg message handlers

void CSetAutoRunDlg::OnAutorunsaveButton() 
{
	// TODO: Add your control notification handler code here
	UpdateData();
	//save
	//auto run
	if(m_autorun_flag)
       m_system_para.m_auto_run_flag=1; 
	else
       m_system_para.m_auto_run_flag=0; 
   //watchdog
//	if(m_watchdog_flag)
 //      m_system_para.m_watchdog_flag=1; 
//	else
 //      m_system_para.m_watchdog_flag=0; 
	//
    wcscpy(m_system_para.m_autorun_tabfile,m_autorun_tabfilename);
	//
	wcscpy(m_system_para.m_save_pathname,m_save_pathname);
	///
	COleDateTime m_oledatetime;
	m_datetimectrl.GetTime(m_oledatetime);

    //hour
	m_system_para.hour =m_oledatetime.GetHour();
	//minute
	m_system_para.minute =m_oledatetime.GetMinute();
	//second
	m_system_para.second =m_oledatetime.GetSecond();
	//save...
	 FILE *fp;
	 fp=_tfopen(m_ini_pathname,L"wb");
	 if(fp)
	 {
       
	   fwrite((char*)&m_system_para,1,sizeof(SYSTEM_PARAMETER),fp);  
	   
       fclose(fp);
	 }
	 //write register table
	 //HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run
	/* HKEY hOpenkey;
	 long lResult=0;
	 //define key name
	 LPCTSTR keyname=L"Software\\Microsoft\\Windows\\CurrentVersion\\Run";

	 if(m_auto_flag)//设为自启运运行
	 {

	 }
	 else//取消自启动运行
	 {
	 }*/
	 EndDialog(0);
}

void CSetAutoRunDlg::OnOkButton() 
{
	// TODO: Add your control notification handler code here
	EndDialog(0);
}

BOOL CSetAutoRunDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	//LOAD PARA...
	//auto run
	if(m_system_para.m_auto_run_flag==0)
		m_autorun_flag=FALSE;
	else
        m_autorun_flag=TRUE;
	//watchdog 
	//if(m_system_para.m_watchdog_flag==0)
	//	m_watchdog_flag=FALSE;
	//else
    //    m_watchdog_flag=TRUE;
    //
	m_autorun_tabfilename=m_system_para.m_autorun_tabfile; 
	//
	m_save_pathname=m_system_para.m_save_pathname;
	//
	COleDateTime m_oledatetime(2006,9,1,m_system_para.hour,m_system_para.minute,m_system_para.second);
	m_datetimectrl.SetTime(m_oledatetime); 
	UpdateData(FALSE);
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CSetAutoRunDlg::OnOpentabButton() 
{
	// TODO: Add your control notification handler code here
	CFileDialog filedlg(TRUE,_T("TAB"),NULL,OFN_HIDEREADONLY,L"PlayTable Files(*.TAB)|*.TAB|All Files(*.*)|*.*||");
	filedlg.m_ofn.lpstrInitialDir=_T("\\");  
	filedlg.m_ofn.lpstrTitle=TEXT("Open Tab File"); 
	CString tmpfile;
	if(filedlg.DoModal()==IDOK)
	{
	 tmpfile=filedlg.GetPathName();	
	 m_autorun_tabfilename=tmpfile;
	 UpdateData(FALSE);
	}
}

⌨️ 快捷键说明

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