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

📄 mainfrm.cpp

📁 这是一套学校设备管理系统的源码 里面有树形结构使用的很棒的方法
💻 CPP
字号:
 // MainFrm.cpp : implementation of the CMainFrame class
//

#include "stdafx.h"
#include "xxgl.h"
#include "MainFrm.h"
#include "strt.h"
#include "ext.h"
#include "func.h"
#include "time.h"

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

/////////////////////////////////////////////////////////////////////////////
// CMainFrame

IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)

BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
	//{{AFX_MSG_MAP(CMainFrame)
	ON_WM_CREATE()
	ON_COMMAND(ID_zmgl_drsj, Onzmgldrsj)
	ON_COMMAND(ID_sbgl_sbck, Onsbglsbck)
	ON_COMMAND(ID_sbsj_xxqktjbb, Onsbsjxxqktjbb)
	ON_COMMAND(ID_xxgm_jftrqk, Onxxgmjftrqk)
	ON_COMMAND(ID_xxgm_sysjxryqk, Onxxgmsysjxryqk)
	ON_COMMAND(ID_xxgm_syssbzk, Onxxgmsyssbzk)
	ON_COMMAND(ID_xxgm_sysslqk, Onxxgmsysslqk)
	ON_COMMAND(ID_xxgm_syssyzk, Onxxgmsyssyzk)
	ON_COMMAND(ID_xxgm_tsgdngzqk, Onxxgmtsgdngzqk)
	ON_COMMAND(ID_xxgm_tsgglryzk, Onxxgmtsgglryzk)
	ON_COMMAND(ID_xxgm_tsgsszk, Onxxgmtsgsszk)
	ON_COMMAND(ID_xxgm_xxqk, Onxxgmxxqk)
	ON_COMMAND(ID_xxgm_tsgcsqk, Onxxgmtsgcsqk)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

static UINT indicators[] =
{
	ID_SEPARATOR,           // status line indicator
	ID_INDICATOR_CAPS,
	ID_INDICATOR_NUM,
	ID_INDICATOR_SCRL,
};

/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction

CMainFrame::CMainFrame()
{
	// TODO: add member initialization code here
	int year,month,day;
    time_t ltime;    
	struct tm *pti;

    time(&ltime);    
	pti = gmtime(&ltime);
	year = pti->tm_year + 1900;
	itoa(year,g_cur_year,10);
//	Get  CWinApp process.h
/*
	wd = this;
	wdp = wd->GetParent();
	while (wdp != NULL){
      wd = wdp;
	  wdp = wd->GetParent();
    }
	wdp = wd;
	wd = wdp->GetNextWindow(GW_HWNDNEXT);
    while (wd != NULL){
	    wd->GetWindowText(bufs,20);
        if (strcmp(bufs,"学校设备管理系统 - ") == 0)
		  nums ++;
		wd = wd->GetNextWindow(GW_HWNDNEXT);
    }
	wd = wdp->GetNextWindow(GW_HWNDPREV);
    while (wd != NULL){
	    wd->GetWindowText(bufs,20);
        if (strcmp(bufs,"学校设备管理系统 - ") == 0)
		  nums ++;
		wd = wd->GetNextWindow(GW_HWNDNEXT);
    }
	if (nums > 1){
		exit(0);
    }
*/
}

CMainFrame::~CMainFrame()
{
}

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	CWnd *wd,*wdp;
	long l;
	char bufs[100];
	int nums;

	nums = 0;
	wd = GetNextWindow(GW_HWNDNEXT);
    while (wd != NULL){
	    wd->GetWindowText(bufs,20);
        if (strcmp(bufs,"学校设备管理系统 - ") == 0)
		  nums ++;
		wd = wd->GetNextWindow(GW_HWNDNEXT);
    }
	wd = GetNextWindow(GW_HWNDPREV);
    while (wd != NULL){
	    wd->GetWindowText(bufs,20);
        if (strcmp(bufs,"学校设备管理系统 - ") == 0)
		  nums ++;
		wd = wd->GetNextWindow(GW_HWNDNEXT);
    }
	if (nums > 0){
		exit(0);
    }

	if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	if (!m_wndToolBar.Create(this) ||
		!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
	{
		TRACE0("Failed to create toolbar\n");
		return -1;      // fail to create
	}

	if (!m_wndStatusBar.Create(this) ||
		!m_wndStatusBar.SetIndicators(indicators,
		  sizeof(indicators)/sizeof(UINT)))
	{
		TRACE0("Failed to create status bar\n");
		return -1;      // fail to create
	}

	// TODO: Remove this if you don't want tool tips or a resizeable toolbar
	m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
		CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);

	// TODO: Delete these three lines if you don't want the toolbar to
	//  be dockable
	m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
	EnableDocking(CBRS_ALIGN_ANY);
	DockControlBar(&m_wndToolBar);


	return 0;
}

BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CFrameWnd::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics

#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
	CFrameWnd::AssertValid();
}

void CMainFrame::Dump(CDumpContext& dc) const
{
	CFrameWnd::Dump(dc);
}

#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers

void CMainFrame::Onzmgldrsj() 
{
	// TODO: Add your command handler code here
}

void CMainFrame::Onsbglsbck() 
{
	// TODO: Add your command handler code here
	
}

void CMainFrame::Onsbsjxxqktjbb() 
{
	// TODO: Add your command handler code here
	
}

void CMainFrame::Onxxgmjftrqk() 
{
	// TODO: Add your command handler code here
	
}

void CMainFrame::Onxxgmsysjxryqk() 
{
	// TODO: Add your command handler code here
	
}

void CMainFrame::Onxxgmsyssbzk() 
{
	// TODO: Add your command handler code here
	
}

void CMainFrame::Onxxgmsysslqk() 
{
	// TODO: Add your command handler code here
	
}

void CMainFrame::Onxxgmsyssyzk() 
{
	// TODO: Add your command handler code here
	
}

void CMainFrame::Onxxgmtsgdngzqk() 
{
	// TODO: Add your command handler code here
	
}

void CMainFrame::Onxxgmtsgglryzk() 
{
	// TODO: Add your command handler code here
	
}

void CMainFrame::Onxxgmtsgsszk() 
{
	// TODO: Add your command handler code here
	
}

void CMainFrame::Onxxgmxxqk() 
{
	// TODO: Add your command handler code here
	
}

void CMainFrame::Onxxgmtsgcsqk() 
{
	// TODO: Add your command handler code here
	
}

⌨️ 快捷键说明

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