📄 售货系统.cpp
字号:
// 售货系统.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "售货系统.h"
#include "售货系统Dlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
CDatabase m_database;
CString username;
CString userpower;
CMainDlg* maindlg;
//CUserDlg* userdlg;
CMyDlg*mydlg;
CString getdate();
CString getpath();
/////////////////////////////////////////////////////////////////////////////
// CMyApp
BEGIN_MESSAGE_MAP(CMyApp, CWinApp)
//{{AFX_MSG_MAP(CMyApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyApp construction
CMyApp::CMyApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CMyApp object
CMyApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CMyApp initialization
BOOL CMyApp::InitInstance()
{
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
if(!m_database.IsOpen()){
try{
m_database.Open(_T("售货系统"),false,false,_T("ODBC;UID=sa;UPASSWORD="),true);
}catch(CDBException e1){
e1.GetErrorMessage("无法连接数据库",0,NULL);
}
catch(CMemoryException e2){
e2.GetErrorMessage("无法连接数据库",0,NULL);
}
}
maindlg=new CMainDlg;
if(maindlg->GetSafeHwnd()==0)
maindlg->Create(IDD_MAIN);
mydlg=new CMyDlg;
if(mydlg->GetSafeHwnd()==0)
mydlg->Create(IDD_MY_DIALOG);
m_pMainWnd = mydlg;
mydlg->ShowWindow(SW_SHOW);
return TRUE;
}
int CMyApp::ExitInstance()
{
// TODO: Add your specialized code here and/or call the base class
delete maindlg;
return CWinApp::ExitInstance();
}
CString getdate() //获取当前时间
{
CTime tCurTime;
CString s;
tCurTime=CTime::GetCurrentTime();
s.Format("%d-%d-%d %d:%d:%d",
tCurTime.GetYear(),tCurTime.GetMonth(),tCurTime.GetDay(),
tCurTime.GetHour(),tCurTime.GetMinute(),tCurTime.GetSecond());
return s;
}
CString getpath(){
CString path;
char temp[100];
GetModuleFileName(NULL,path.GetBuffer(MAX_PATH),MAX_PATH);
path.ReleaseBuffer();
strcpy(temp,path);
temp[strlen(temp)-12]='\0';
path.Format("%s",temp);
return path;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -