📄 infinput.cpp
字号:
// InfInput.cpp : implementation file
//
#include "stdafx.h"
#include "PIM.h"
#include "InfInput.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CInfInput dialog
CInfInput::CInfInput(CWnd* pParent /*=NULL*/)
: CDialog(CInfInput::IDD, pParent)
{
//{{AFX_DATA_INIT(CInfInput)
m_sName = _T("");
m_sPath = _T("");
m_sSynopsis = _T("");
//}}AFX_DATA_INIT
}
void CInfInput::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CInfInput)
DDX_Text(pDX, IDC_NAME, m_sName);
DDX_Text(pDX, IDC_PATH, m_sPath);
DDX_Text(pDX, IDC_SYNOPSIS, m_sSynopsis);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CInfInput, CDialog)
//{{AFX_MSG_MAP(CInfInput)
ON_WM_CREATE()
ON_BN_CLICKED(IDC_SELECTFILE, OnSelectfile)
ON_BN_CLICKED(IDC_INPUT, OnInput)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CInfInput message handlers
BOOL CInfInput::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
}
int CInfInput::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDialog::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
AfxInitRichEdit();
return 0;
}
void CInfInput::OnSelectfile()
{
// TODO: Add your control notification handler code here
// CString filename;
CFileDialog dlg(TRUE,NULL, NULL, OFN_HIDEREADONLY,\
"txt Files (*.txt)|*.txt|All File(*.*)|*.*||",NULL);
if(dlg.DoModal()==IDOK)
{
m_sName=dlg.GetFileName();
m_sPath=dlg.GetPathName();
char find = '\\';
int i = m_sPath.ReverseFind(find);
int j = m_sPath.GetLength();
m_sPath.Delete(i,j-i);
UpdateData(false);
// AfxMessageBox(filename);
}
}
void CInfInput::OnInput()
{
// TODO: Add your control notification handler code here
UpdateData(true);
if (theApp.m_pADOSet->State != adStateClosed)
{
theApp.m_pADOSet->Close();
}
_variant_t Holder, strQuery;
strQuery = "select * from 资料";
theApp.ADOExecute(theApp.m_pADOSet, strQuery);
theApp.m_pADOSet->AddNew();
theApp.m_pADOSet->PutCollect("文件名",_variant_t(LPCTSTR(m_sName)));
theApp.m_pADOSet->PutCollect("路径",_variant_t(LPCTSTR(m_sPath)));
theApp.m_pADOSet->PutCollect("内容提要",_variant_t(LPCTSTR(m_sSynopsis)));
if(theApp.m_pADOSet->Update() == S_OK)
{
AfxMessageBox("添加成功");
theApp.m_pADOSet->Close();
return;
}
//theApp.m_pADOSet->Update();
theApp.m_pADOSet->Close();
AfxMessageBox("添加失败");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -