📄 final.cpp
字号:
#include "stdafx.h"
#include "final.h"
#include "finalDlg.h"
#include "LOADDING.h"//加载loadding对话框的类
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
BOOL checktdatabase();//判断数据库是否存在的函数
// CFinalApp
BEGIN_MESSAGE_MAP(CFinalApp, CWinApp)//事件响应集
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()
// CFinalApp construction
CFinalApp::CFinalApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CFinalApp object
CFinalApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CFinalApp initialization
BOOL CFinalApp::InitInstance()
{
AfxEnableControlContainer();
if( FindWindow(NULL,"学生成绩管理系统")) {//---------------防止运行多次------------
AfxMessageBox("程序已经被运行!");
exit(0);
}
if(!checktdatabase())
return FALSE;
CLOADDING *ploa=new CLOADDING;//---生成loading对话框
ploa->Create(IDD_LOAD_DIALOG);
ploa->ShowWindow(SW_SHOW);
ploa->UpdateWindow();
Sleep(4000); //-------------------使程序暂停
ploa->DestroyWindow();//------------销毁loading对话框
delete ploa;
//if(!checktdatabase())//-------------调用检查是否有数据库的函数
// return FALSE;
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
// 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
CFinalDlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}
BOOL checktdatabase(){
CString sFile("data.yil");//---------定义文件的名字"data.yil"
CFileStatus status;//----------------测试课程数据库是否存在
if (!CFile::GetStatus(sFile,status))
{
AfxMessageBox("数据库不存在!");
return FALSE;
}
else
return TRUE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -