📄 openwork.cpp
字号:
// Openwork.cpp : implementation file
//
#include "stdafx.h"
#include "demo_devstudio.h"
#include "Openwork.h"
#include "Mainfrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// COpenwork dialog
COpenwork::COpenwork(CWnd* pParent /*=NULL*/)
: CDialog(COpenwork::IDD, pParent)
{
//{{AFX_DATA_INIT(COpenwork)
m_zuoyename = _T("");
//}}AFX_DATA_INIT
}
void COpenwork::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(COpenwork)
DDX_Control(pDX, IDC_COMBO1, m_combox);
DDX_CBString(pDX, IDC_COMBO1, m_zuoyename);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(COpenwork, CDialog)
//{{AFX_MSG_MAP(COpenwork)
ON_BN_CLICKED(IDC_WORKCONFIG, OnWorkconfig)
ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// COpenwork message handlers
void COpenwork::OnWorkconfig()
{
// TODO: Add your control notification handler code here
UpdateData(true);
m_zuoyename.TrimLeft();
m_zuoyename.TrimRight();
if(m_zuoyename.IsEmpty())
{AfxMessageBox("请选择作业");
return;
}
if(m_combox.FindStringExact(-1,m_zuoyename)==CB_ERR)
{ MessageBox("没有此工作名,请先新建一个");
return;
}
CMainFrame *pmainframe;
pmainframe=(CMainFrame*)AfxGetApp()->m_pMainWnd;
pmainframe->m_myworkname=m_zuoyename;
CDialog::OnOK();
}
BOOL COpenwork::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_combox.ResetContent();
//m_combox.Dir(DDL_READWRITE,"*.mdb");
WIN32_FIND_DATA pfindata;
CString findname;
TCHAR fullpath[150];
::GetModuleFileName(NULL,fullpath,150);
findname.Empty();
findname+=fullpath;
int pos;
pos=findname.ReverseFind('\\');
findname=findname.Left(pos);
findname+="\\*.mdb";
HANDLE phandle=FindFirstFile(findname,&pfindata);
if(phandle==INVALID_HANDLE_VALUE)
return true;
CString workname;
int isfind=true;
while(isfind)
{
workname=pfindata.cFileName;
workname=workname.Left(workname.GetLength()-4);
m_combox.AddString(workname);
isfind=FindNextFile(phandle,&pfindata);
}
::FindClose(phandle);
m_combox.SetCurSel(0);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void COpenwork::OnButton2()
{
// TODO: Add your control notification handler code here
CDialog::OnCancel();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -