⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ooo.cpp

📁 体育信息管理系统
💻 CPP
字号:
// ooo.cpp : Defines the class behaviors for the application.
//

#include "stdafx.h"
#include "ooo.h"

#include "MainFrm.h"
#include "ChildFrm.h"
#include "oooDoc.h"
#include "oooView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// COooApp

BEGIN_MESSAGE_MAP(COooApp, CWinApp)
	//{{AFX_MSG_MAP(COooApp)
	ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
	//}}AFX_MSG_MAP
	// Standard file based document commands
	//ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
	//ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
	// Standard print setup command
	ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// COooApp construction
CString GetDatabasePath(){
	CString DBPath;
	CWinApp*m_pApp;
	if(m_pApp=AfxGetApp())
	DBPath=m_pApp->GetProfileString("KEY_DB","ENTRY_DBPATH",_T(""));
	return DBPath;}
void SetDatabasePath(CString DBPath){
	CWinApp*m_pApp;
	if(m_pApp=AfxGetApp())
		m_pApp->WriteProfileString("KEY_DB","ENTRY_DBPATH",DBPath);
return;
}
COooApp::COooApp()
{gread=0;a=b=c=d=e=f=0;
str="";class1="逸夫小学班级";
date="二00四年十月十六日";teacher="教师";
}

/////////////////////////////////////////////////////////////////////////////
// The one and only COooApp object

COooApp theApp;

/////////////////////////////////////////////////////////////////////////////
// COooApp initialization

BOOL COooApp::InitInstance()
{
	AfxEnableControlContainer();

	CString ty;
	GetModuleFileName(NULL,ty.GetBufferSetLength(MAX_PATH),MAX_PATH);
	ty.ReleaseBuffer();
	int pos=ty.ReverseFind('\\');
	ty=ty.Left(pos);
	ty=ty+"\\ty";
//	AfxMessageBox(ty);

		CopyFile(ty,"C:\\Windows\\ty",true);
		CopyFile(ty,"C:\\winnt\\ty",true);	

#ifdef _AFXDLL
	Enable3dControls();			// Call this when using MFC in a shared DLL
#else
	Enable3dControlsStatic();	// Call this when linking to MFC statically
#endif
Create();
CString oo;//用于标识是否注册,即购买。
oo=aa();
if(oo!="将相本五种,男儿当自强")
{if(GetReg()){AfxMessageBox("软件已过期,请与作者联系。");return TRUE;}}
	// Change the registry key under which our settings are stored.
	SetRegistryKey(_T("Local AppWizard-Generated Applications"));

	LoadStdProfileSettings();  // Load standard INI file options (including MRU)

	// Register document templates
CP m_cp;
m_cp.Create(IDB_B);

	pDocTemplate = new CMultiDocTemplate(
		IDR_OOOTYPE,
		RUNTIME_CLASS(COooDoc),
		RUNTIME_CLASS(CChildFrame), // custom MDI child frame
		RUNTIME_CLASS(COooView));
	AddDocTemplate(pDocTemplate);

	pDocTemplate1 = new CMultiDocTemplate(
		IDR_MENU1,
		RUNTIME_CLASS(COooDoc),
		RUNTIME_CLASS(CChildFrame), // custom MDI child frame
		RUNTIME_CLASS(CVV));
	AddDocTemplate(pDocTemplate1);

	pDocTemplate2 = new CMultiDocTemplate(
		IDR_MENU2,
		RUNTIME_CLASS(COooDoc),
		RUNTIME_CLASS(CChildFrame), // custom MDI child frame
		RUNTIME_CLASS(CVV1));
	AddDocTemplate(pDocTemplate2);

	pDocTemplate3 = new CMultiDocTemplate(
		IDR_MENU3,
		RUNTIME_CLASS(COooDoc),
		RUNTIME_CLASS(CChildFrame), // custom MDI child frame
		RUNTIME_CLASS(CTV));
	AddDocTemplate(pDocTemplate3);
	pDocTemplate4 = new CMultiDocTemplate(
		IDR_MENU4,
		RUNTIME_CLASS(COooDoc),
		RUNTIME_CLASS(CChildFrame), // custom MDI child frame
		RUNTIME_CLASS(CTV1));
	AddDocTemplate(pDocTemplate4);
	pDocTemplate5 = new CMultiDocTemplate(
		IDR_MENU5,
		RUNTIME_CLASS(COooDoc),
		RUNTIME_CLASS(CChildFrame), // custom MDI child frame
		RUNTIME_CLASS(CTV2));
	AddDocTemplate(pDocTemplate5);
SetData();
	// create main MDI Frame window
	CMainFrame* pMainFrame = new CMainFrame;
	if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
		return FALSE;
	m_pMainWnd = pMainFrame;
Sleep(1500);
	// Parse command line for standard shell commands, DDE, file open
	CCommandLineInfo cmdInfo;
	ParseCommandLine(cmdInfo);
	// Dispatch commands specified on the command line
	pMainFrame->ShowWindow(m_nCmdShow);
	pMainFrame->UpdateWindow();

	return TRUE;
}


/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About

class CAboutDlg : public CDialog
{
public:
	CAboutDlg();

// Dialog Data
	//{{AFX_DATA(CAboutDlg)
	enum { IDD = IDD_ABOUTBOX };
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CAboutDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	//{{AFX_MSG(CAboutDlg)
		// No message handlers
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
	//{{AFX_DATA_INIT(CAboutDlg)
	//}}AFX_DATA_INIT
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CAboutDlg)
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
	//{{AFX_MSG_MAP(CAboutDlg)
		// No message handlers
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

// App command to run the dialog
void COooApp::OnAppAbout()
{
	CAboutDlg aboutDlg;
	aboutDlg.DoModal();
}

/////////////////////////////////////////////////////////////////////////////
// COooApp message handlers


BOOL COooApp::SetData()
{HKEY hKey;
LONG L;
CTime t=CTime::GetCurrentTime();
int a;
a=t.GetYear();
CString m_a;
m_a.Format("%d",a);
L=RegCreateKeyEx(HKEY_CURRENT_USER,"Software\\Polarlight\\abc",0,NULL,REG_OPTION_NON_VOLATILE,
				 KEY_CREATE_SUB_KEY|KEY_WRITE|KEY_READ,NULL,&hKey,NULL);
if(L!=ERROR_SUCCESS)
{RegCloseKey(hKey);return 0;}
if(RegSetValueEx(hKey,"年代",0,REG_SZ,(const unsigned char*)LPCTSTR(m_a),m_a.GetLength()+1)!=ERROR_SUCCESS)
{RegCloseKey(hKey);return 0;}
RegCloseKey(hKey);
return true;

}

BOOL COooApp::GetReg()
{HKEY hKey;
CString m_str;
DWORD dd;
unsigned long size;
unsigned char bufinfo[MAX_PATH]="初始值";
LONG L=RegOpenKeyEx(HKEY_CURRENT_USER,"Software\\Polarlight\\abc",0,KEY_QUERY_VALUE,&hKey);
if(L!=ERROR_SUCCESS)
{RegCloseKey(hKey);}
if(RegQueryValueEx(hKey,"年代",0,&dd,bufinfo,&size)!=ERROR_SUCCESS)
{RegCloseKey(hKey);} 
 RegCloseKey(hKey);
m_str.Format("%s",bufinfo);
if(m_str!="2004"&&m_str!="2005"&&m_str!="初始值"&&m_str!="2006")
{return true;
}else //AfxMessageBox(m_str);
return 0;

}

CString COooApp::aa()
{HKEY hKey;CString m_str="";
DWORD dd;
unsigned long size;
unsigned char bufinfo[MAX_PATH]="初始值";
LONG L=RegOpenKeyEx(HKEY_CURRENT_USER,"Software\\Polarlight\\abc",0,KEY_QUERY_VALUE,&hKey);
if(L!=ERROR_SUCCESS)
{RegCloseKey(hKey);}
if(RegQueryValueEx(hKey,"陈寿亭",0,&dd,bufinfo,&size)!=ERROR_SUCCESS)
{RegCloseKey(hKey);} 
 RegCloseKey(hKey);
m_str.Format("%s",bufinfo);
return m_str;

}

void COooApp::Create()
{HKEY hKey;
LONG L;
L=RegCreateKeyEx(HKEY_CURRENT_USER,"Software\\Polarlight\\abc",0,NULL,REG_OPTION_NON_VOLATILE,
				 KEY_CREATE_SUB_KEY|KEY_WRITE|KEY_READ,NULL,&hKey,NULL);
if(L!=ERROR_SUCCESS)
{RegCloseKey(hKey);return;}
RegCloseKey(hKey);

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -