?? step33.cpp
字號:
// Step33.cpp : implementation file
//
#include "stdafx.h"
#include "Data_Trans.h"
#include "Data_TransDlg.h"
#include "Step33.h"
#include "VirtualInfoFile.h"
#include "FileDialogST.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CStep33 dialog
CStep33::CStep33(CWnd* pParent /*=NULL*/)
: CDialog(CStep33::IDD, pParent)
{
//{{AFX_DATA_INIT(CStep33)
m_filename = _T("");
//}}AFX_DATA_INIT
m_Dlg = (CData_TransDlg*)pParent;
m_bFirst = false;
}
void CStep33::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CStep33)
DDX_Control(pDX, IDC_EDIT1, m_strFileName);
DDX_Control(pDX, IDC_DATETIMEPICKER4, m_ctrlTimeEnd);
DDX_Control(pDX, IDC_DATETIMEPICKER2, m_ctrlDayEnd);
DDX_Control(pDX, IDC_DATETIMEPICKER3, m_ctrlTimeStart);
DDX_Control(pDX, IDC_DATETIMEPICKER1, m_ctrlDayStart);
DDX_Control(pDX, IDC_COMBO1, m_DataName);
DDX_Text(pDX, IDC_EDIT1, m_filename);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CStep33, CDialog)
//{{AFX_MSG_MAP(CStep33)
ON_WM_PAINT()
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CStep33 message handlers
BOOL CStep33::OnInitDialog()
{
CDialog::OnInitDialog();
// 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 CStep33::OnPaint()
{
CPaintDC dc(this); // device context for painting
if (!m_bFirst)
{
for (int i=0;i<m_Dlg->m_arrayInfoFile.GetSize();++i)
{
m_DataName.AddString(m_Dlg->m_arrayInfoFile[i]->SvrGetFileName());
}
m_bFirst = true;
}
UpdateData(FALSE);
int iSel = m_DataName.GetCurSel();
if (iSel == CB_ERR)
{
return ;
}
m_DataName.GetLBText(iSel,m_Dlg->m_strDataName);
SYSTEMTIME system,system1;
m_ctrlDayStart.GetTime(&system);
m_ctrlTimeStart.GetTime(&system1);
system.wHour = system1.wHour;
system.wMinute = system1.wMinute;
system.wSecond = system1.wSecond;
COleDateTime startTime,endTime;
m_Dlg->m_startTime = system;
m_ctrlDayEnd.GetTime(&system);
m_ctrlTimeEnd.GetTime(&system1);
system.wHour = system1.wHour;
system.wMinute = system1.wMinute;
system.wSecond = system1.wSecond;
m_Dlg->m_endTime = system;
CString filename = m_filename;
m_Dlg->m_strFileName = filename;
m_Dlg->m_iType = 0; //設置路徑
m_Dlg->SetWizButton(5);
// TODO: Add your message handler code here
// Do not call CDialog::OnPaint() for painting messages
}
int CStep33::SvrSetPar() //設置參數
{
UpdateData();
int iSel = m_DataName.GetCurSel();
if (iSel == CB_ERR)
{
return -1;
}
m_DataName.GetLBText(iSel,m_Dlg->m_strDataName);
SYSTEMTIME system,system1;
m_ctrlDayStart.GetTime(&system);
m_ctrlTimeStart.GetTime(&system1);
system.wHour = system1.wHour;
system.wMinute = system1.wMinute;
system.wSecond = system1.wSecond;
COleDateTime startTime,endTime;
m_Dlg->m_startTime = system;
m_ctrlDayEnd.GetTime(&system);
m_ctrlTimeEnd.GetTime(&system1);
system.wHour = system1.wHour;
system.wMinute = system1.wMinute;
system.wSecond = system1.wSecond;
m_Dlg->m_endTime = system;
CString filename = m_filename;
m_Dlg->m_strFileName = filename;
m_Dlg->m_iType = 0; //設置路徑
m_Dlg->SetWizButton(5);
return 0;
}
//進行文件的轉換
void CStep33::OnButton1()
{
// TODO: Add your control notification handler code here
int iSel = m_DataName.GetCurSel();
if (iSel == CB_ERR)
{
AfxMessageBox("please choose data-object");
return ;
}
UpdateData();
CString filename;
/* if (m_filename.IsEmpty())
{
AfxMessageBox("請設置文件名稱");
return ;
}
int iPos2 = m_filename.ReverseFind(_T('.'));
if (iPos2 != -1)
{
m_filename = m_filename.Mid( 0, iPos2 );
m_filename += "txt";
}
else
{
m_filename += ".txt";
}
*/
int nRetValue;
CString sFolder;
CFileDialogST dlg(FALSE, NULL, NULL, OFN_FILEMUSTEXIST | OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST, _T("All files\0*.*\0"), this);
CString sPathName;
nRetValue = dlg.DoModal();
if (nRetValue == IDOK)
{
sPathName = dlg.GetPathName();
int iPos2 = sPathName.ReverseFind(_T('.'));
if (iPos2 != -1)
{
sPathName = sPathName.Mid( 0, iPos2+1 );
sPathName += "txt";
}
else
{
sPathName += ".txt";
}
filename = sPathName;
m_filename = filename;
} // if
else
{
return ;
}
UpdateData(FALSE);
m_DataName.GetLBText(iSel,m_Dlg->m_strDataName);
SYSTEMTIME system,system1;
m_ctrlDayStart.GetTime(&system);
m_ctrlTimeStart.GetTime(&system1);
system.wHour = system1.wHour;
system.wMinute = system1.wMinute;
system.wSecond = system1.wSecond;
COleDateTime startTime,endTime;
m_Dlg->m_startTime = system;
m_ctrlDayEnd.GetTime(&system);
m_ctrlTimeEnd.GetTime(&system1);
system.wHour = system1.wHour;
system.wMinute = system1.wMinute;
system.wSecond = system1.wSecond;
m_Dlg->m_endTime = system;
m_Dlg->m_strFileName = filename;
m_Dlg->m_iType = 0; //設置路徑
m_Dlg->SetWizButton(5);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -