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

📄 smeswhydlg.cpp

📁 专家系统是研究用解决某专门问题的专家知识来建立人机系统的方法和技术。
💻 CPP
字号:
// SMESWHYDlg.cpp : implementation file
//

#include "stdafx.h"
#include "SMESWHY.h"
#include "SMESWHYDlg.h"
#include "MainMenu.h"

#include "ZKTDLG.h"
#include "BKTDLG.h"
#include "STUDLG.h"
#include "SEARCHDLG.h"
#include "ODBCSETUP.h"
#include "QUERYDLG.h"
#include "winbase.h"





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

/////////////////////////////////////////////////////////////////////////////
// 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)
	virtual void OnOK();
	//}}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)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSMESWHYDlg dialog

CSMESWHYDlg::CSMESWHYDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CSMESWHYDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CSMESWHYDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CSMESWHYDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CSMESWHYDlg)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CSMESWHYDlg, CDialog)
	//{{AFX_MSG_MAP(CSMESWHYDlg)
	ON_WM_SYSCOMMAND()
	ON_WM_PAINT()
	ON_WM_QUERYDRAGICON()
	ON_WM_LBUTTONDOWN()
	ON_WM_RBUTTONDOWN()
	ON_COMMAND(ID_MENUITEMABT, OnMenuitemabt)
	ON_COMMAND(ID_MENUITEMBKT, OnMenuitembkt)
	ON_COMMAND(ID_MENUITEMDPT, OnMenuitemdpt)
	ON_COMMAND(ID_MENUITEMEXIT, OnMenuitemexit)
	ON_COMMAND(ID_MENUITEMSEA, OnMenuitemsea)
	ON_COMMAND(ID_MENUITEMZKT, OnMenuitemzkt)
	ON_BN_CLICKED(IDC_BUTTONBKS, OnButtonbks)
	ON_BN_CLICKED(IDC_BUTTONSEARCH, OnButtonsearch)
	ON_BN_CLICKED(IDC_BUTTONSTU, OnButtonstu)
	ON_BN_CLICKED(IDC_BUTTONZKS, OnButtonzks)
	ON_BN_CLICKED(IDC_BUTTONABT, OnButtonabt)
	ON_WM_CLOSE()
	ON_BN_CLICKED(IDC_BUTTONEXIT, OnButtonexit)
	ON_BN_CLICKED(IDC_BUTTONODECSETUP, OnButtonodecsetup)
	ON_COMMAND(ID_MENUITEMODBCST, OnMenuitemodbcst)
	ON_BN_CLICKED(IDC_BUTTONJUDGE, OnButtonjudge)
	ON_COMMAND(IDR_MENUASK, OnMenuask)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSMESWHYDlg message handlers

BOOL CSMESWHYDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// 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);

	CMenu* pSysMenu = GetSystemMenu(FALSE);
	if (pSysMenu != NULL)
	{
		CString strAboutMenu;
		strAboutMenu.LoadString(IDS_ABOUTBOX);
		if (!strAboutMenu.IsEmpty())
		{
			pSysMenu->AppendMenu(MF_SEPARATOR);
			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
		}
	}

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon
	
	// TODO: Add extra initialization here
	pNewMenu = new CMenu; 
	pNewMenu->LoadMenu(IDR_MENUMAIN); 
	// 设置主框架菜单 
	SetMenu(pNewMenu);
	return TRUE;  // return TRUE  unless you set the focus to a control
}

void CSMESWHYDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
	if ((nID & 0xFFF0) == IDM_ABOUTBOX)
	{
		CAboutDlg dlgAbout;
		dlgAbout.DoModal();
	}
	else
	{
		CDialog::OnSysCommand(nID, lParam);
	}
}

// If you add a minimize button to your dialog, you will need the code below
//  to draw the icon.  For MFC applications using the document/view model,
//  this is automatically done for you by the framework.

void CSMESWHYDlg::OnPaint() 
{
	if (IsIconic())
	{
		CPaintDC dc(this); // device context for painting

		SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

		// Center icon in client rectangle
		int cxIcon = GetSystemMetrics(SM_CXICON);
		int cyIcon = GetSystemMetrics(SM_CYICON);
		CRect rect;
		GetClientRect(&rect);
		int x = (rect.Width() - cxIcon + 1) / 2;
		int y = (rect.Height() - cyIcon + 1) / 2;

		// Draw the icon
		dc.DrawIcon(x, y, m_hIcon);
	}
	else
	{
		CDialog::OnPaint();
	}
}

// The system calls this to obtain the cursor to display while the user drags
//  the minimized window.
HCURSOR CSMESWHYDlg::OnQueryDragIcon()
{
	return (HCURSOR) m_hIcon;
}

void CSMESWHYDlg::OnLButtonDown(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
/*	CMainMenu popmenu,*popmenu;
if(!popmenu.LoadMenu(IDR_MENUMAIN)) //装入菜单资源。
{
	MessageBox("菜单装入失败!","错误",MB_OK|MB_ICONERROR);
	return; //如装入失败,显示消息框,且返回。
}
popmenu=AfxGetMainWnd()->GetMenu();
*/
CDialog::OnLButtonDown(nFlags, point);
}

void CSMESWHYDlg::OnRButtonDown(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
/*
	CMainMenu popmenu;
if(!popmenu.LoadMenu(IDR_MENUMAIN)) //装入菜单资源。
{
	MessageBox("菜单装入失败!","错误",MB_OK|MB_ICONERROR);
	return; //如装入失败,显示消息框,且返回。
}
popmenu=AfxGetMainWnd()->GetMenu();
*/	
CDialog::OnRButtonDown(nFlags, point);
}

void CSMESWHYDlg::OnMenuitemabt() 
{
	// TODO: Add your command handler code here
	CAboutDlg abtdlg;
	abtdlg.DoModal();
}

void CSMESWHYDlg::OnMenuitembkt() 
{
	// TODO: Add your command handler code here
	BKTDLG bksdlg;
	bksdlg.DoModal();
}

void CSMESWHYDlg::OnMenuitemdpt() 
{
	// TODO: Add your command handler code here
	STUDLG studlg;
	studlg.DoModal();
}

void CSMESWHYDlg::OnMenuitemexit() 
{
	// TODO: Add your command handler code here
	//SendMessage(WM_CLOSE);
	CDialog::DestroyWindow();
}

void CSMESWHYDlg::OnMenuitemsea() 
{
	// TODO: Add your command handler code here
	//shellexec(学生管理系统.exe);
	//winexec(学生管理系统.exe);
	//CString file_string="D:\\systembackup\\why\\stumanagersearch\\Debug\\学生管理系统.exe";
	//WinExec(file_string,SW_SHOWNORMAL);
	SEARCHDLG searchdlg;
	searchdlg.DoModal();
}

void CSMESWHYDlg::OnMenuitemzkt() 
{
	// TODO: Add your command handler code here
	ZKTDLG zksdlg;
	zksdlg.DoModal();
}

void CSMESWHYDlg::OnButtonbks() 
{
	// TODO: Add your control notification handler code here
	BKTDLG bksdlg;
	bksdlg.DoModal();
}

void CSMESWHYDlg::OnButtonsearch() 
{
	// TODO: Add your control notification handler code here
	
	//shellexec(学生管理系统.exe);
	//winexec(学生管理系统.exe);
	//CString file_string="D:\\systembackup\\why\\stumanagersearch\\Debug\\学生管理系统.exe";
	//WinExec(file_string,SW_SHOWNORMAL);
	SEARCHDLG searchdlg;
	searchdlg.DoModal();
	
}

void CSMESWHYDlg::OnButtonstu() 
{
	// TODO: Add your control notification handler code here
	STUDLG studlg;
	studlg.DoModal();
}

void CSMESWHYDlg::OnButtonzks() 
{
	// TODO: Add your control notification handler code here
	ZKTDLG zksdlg;
	zksdlg.DoModal();
}

void CSMESWHYDlg::OnButtonabt() 
{
	// TODO: Add your control notification handler code here
	CAboutDlg abtdlg;
	abtdlg.DoModal();
}

void CSMESWHYDlg::OnClose() 
{
	// TODO: Add your message handler code here and/or call default
	pNewMenu->Detach(); 
	//SendMessage(WM_CLOSE);
	CDialog::OnClose();
}

BOOL CSMESWHYDlg::DestroyWindow() 
{
	// TODO: Add your specialized code here and/or call the base class
	
	return CDialog::DestroyWindow();
}

void CSMESWHYDlg::OnButtonexit() 
{
	// TODO: Add your control notification handler code here
	CDialog::DestroyWindow();
}

void CSMESWHYDlg::OnButtonodecsetup() 
{
	// TODO: Add your control notification handler code here
	ODBCSETUP odbcdlg;
	odbcdlg.DoModal();
}

void CSMESWHYDlg::OnMenuitemodbcst() 
{
	// TODO: Add your command handler code here
	ODBCSETUP odbcdlg;
	odbcdlg.DoModal();
}

void CSMESWHYDlg::OnButtonjudge() 
{
	// TODO: Add your control notification handler code here
	//QUERYDLG querydlg;
	//querydlg.DoModal();
		WinExec("d:\\smeswhy\\stuman.exe",SW_MAXIMIZE);


}

void CSMESWHYDlg::OnMenuask() 
{
	// TODO: Add your command handler code here
	QUERYDLG querydlg;
	querydlg.DoModal();
}

void CAboutDlg::OnOK() 
{
	// TODO: Add extra validation here
	
	CDialog::OnOK();
}

⌨️ 快捷键说明

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