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

📄 bbbdlg.cpp

📁 这是一个图书管理系统,实现了图书馆中日常管理用到的所有操作.
💻 CPP
字号:
// bbbDlg.cpp : implementation file
//

#include "stdafx.h"
#include "bbb.h"
#include "bbbDlg.h"

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

extern BOOL Flag ; 

/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
extern CBbbApp theApp;
extern _ConnectionPtr m_pCon;  //ADO连接对象
extern _RecordsetPtr m_pRs; 
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)
	//}}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()

/////////////////////////////////////////////////////////////////////////////
// CBbbDlg dialog

CBbbDlg::CBbbDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CBbbDlg::IDD, pParent)
{
	pdlgBaseInfoM = NULL;
	pdlgStoreInfoM = NULL;
	pdlgQueryM = NULL;


	bFlag = FALSE;
	//{{AFX_DATA_INIT(CBbbDlg)
		// 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(IDI_ICON1);//IDR_MAINFRAME);
}

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

BEGIN_MESSAGE_MAP(CBbbDlg, CDialog)
	//{{AFX_MSG_MAP(CBbbDlg)
	ON_WM_SYSCOMMAND()
	ON_WM_PAINT()	
	ON_WM_QUERYDRAGICON()
	ON_COMMAND(ID_EXIT, OnNew)
	ON_WM_DRAWITEM()
	ON_WM_MEASUREITEM()
	ON_WM_MOUSEMOVE()
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
	ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
	ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
	ON_BN_CLICKED(IDC_BUTTON5, OnButton5)
	ON_BN_CLICKED(IDC_BUTTON6, OnButton6)
	ON_COMMAND(ID_OPERATOR_M, OnOperatorM)
	ON_BN_CLICKED(IDC_BUTTON4, OnButton4)
	ON_WM_TIMER()
	ON_COMMAND(IDD_ABOUTBOX, OnAboutbox)
	ON_COMMAND(ID_BOOK_INFO, OnBookInfo)
	ON_COMMAND(ID_PROVIDER_INFO, OnProviderInfo)
	ON_COMMAND(ID_BOOK_TYPE, OnBookType)
	ON_COMMAND(ID_CK_INFO, OnCkInfo)
	ON_COMMAND(ID_DESK_INFO, OnDeskInfo)
	ON_COMMAND(ID_BOOK_INPUT, OnBookInput)
	ON_COMMAND(ID_BOOK_PRICE, OnBookPrice)
	ON_COMMAND(ID_BOOK_PRICE_ADJUST, OnBookPriceAdjust)
	ON_COMMAND(ID_INPUT_BACK, OnInputBack)
	ON_COMMAND(ID_BOOK_ADJUST, OnBookAdjust)
	ON_COMMAND(ID_SALE_M, OnSaleM)
	ON_COMMAND(ID_SALE_BACK, OnSaleBack)
	ON_COMMAND(ID_INPUT_QUERY, OnInputQuery)
	ON_COMMAND(ID_INPUT_BACK_QUERY, OnInputBackQuery)
	ON_COMMAND(ID_SALE_QUERY, OnSaleQuery)
	ON_COMMAND(ID_SALE_BACK_QUERY, OnSaleBackQuery)
	ON_BN_CLICKED(IDC_BUTTON8, OnButton8)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CBbbDlg message handlers

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

	// Add "About..." menu item to system menu.
	AdoInit();
	// 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
	m_mnu.AttachMenu(GetMenu()->GetSafeHmenu(),IDR_TOOLBAR1,CSize(16,15));
	
	GetDlgItem(IDC_BUTTON1)->ShowWindow(SW_HIDE);
	GetDlgItem(IDC_BUTTON2)->ShowWindow(SW_HIDE);
	GetDlgItem(IDC_BUTTON3)->ShowWindow(SW_HIDE);
	GetDlgItem(IDC_BUTTON4)->ShowWindow(SW_HIDE);
	GetDlgItem(IDC_BUTTON5)->ShowWindow(SW_HIDE);
	GetDlgItem(IDC_BUTTON6)->ShowWindow(SW_HIDE);
	GetDlgItem(IDCANCEL)->ShowWindow(SW_HIDE);
	GetDlgItem(IDC_BUTTON8)->ShowWindow(SW_HIDE);
	

	SetTimer(1, 1000, NULL);
	return TRUE;  // return TRUE  unless you set the focus to a control
}

void CBbbDlg::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 CBbbDlg::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 CBbbDlg::OnQueryDragIcon()
{
	return (HCURSOR) m_hIcon;
}


void CBbbDlg::OnNew() 
{
	exit(0);
		
}

void CBbbDlg::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct) 
{
	// TODO: Add your message handler code here and/or call default
	m_mnu.DrawItem(lpDrawItemStruct);
	CDialog::OnDrawItem(nIDCtl, lpDrawItemStruct);
}

void CBbbDlg::OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct) 
{
	// TODO: Add your message handler code here and/or call default
	m_mnu.MeasureItem(lpMeasureItemStruct);
	CDialog::OnMeasureItem(nIDCtl, lpMeasureItemStruct);
}

void CBbbDlg::OnMouseMove(UINT nFlags, CPoint point) 
{
	x = point.x;
	y = point.y;
	if (x>=27  &&  y>=141 &&x<=56 &&y<=171)
	{
		HBITMAP hbmp;	
	hbmp = (HBITMAP)::LoadImage(AfxFindResourceHandle(MAKEINTRESOURCE(IDB_BITMAP10), RT_GROUP_ICON),
		MAKEINTRESOURCE(IDB_BITMAP10), IMAGE_BITMAP, 0, 0, 0);

	CButton *p = (CButton *)GetDlgItem(IDC_BUTTON1);

	
	p->ShowWindow(SW_SHOW);
	p->SetFocus();
	p->SetBitmap(hbmp);
	}
	else if(x>=27 && y>=192 && x<=56 && y<=220)
	{
		HBITMAP hbmp;	
	hbmp = (HBITMAP)::LoadImage(AfxFindResourceHandle(MAKEINTRESOURCE(IDB_BITMAP8), RT_GROUP_ICON),
		MAKEINTRESOURCE(IDB_BITMAP8), IMAGE_BITMAP, 0, 0, 0);

	CButton *p = (CButton *)GetDlgItem(IDC_BUTTON2);
	p->ShowWindow(SW_SHOW);
	p->SetBitmap(hbmp);
	}
	else if(x>=27 && y>=245 && x<=56 && y<=266)
	{
		HBITMAP hbmp;	
	hbmp = (HBITMAP)::LoadImage(AfxFindResourceHandle(MAKEINTRESOURCE(IDB_BITMAP9), RT_GROUP_ICON),
		MAKEINTRESOURCE(IDB_BITMAP9), IMAGE_BITMAP, 0, 0, 0);

	CButton *p = (CButton *)GetDlgItem(IDC_BUTTON3);
	p->ShowWindow(SW_SHOW);
	p->SetBitmap(hbmp);
	}
	else if(x>=27 && y>=289 && x<=56 && y<=318)
	{
		HBITMAP hbmp;	
	hbmp = (HBITMAP)::LoadImage(AfxFindResourceHandle(MAKEINTRESOURCE(IDB_BITMAP7), RT_GROUP_ICON),
		MAKEINTRESOURCE(IDB_BITMAP7), IMAGE_BITMAP, 0, 0, 0);

	CButton *p = (CButton *)GetDlgItem(IDC_BUTTON4);
	p->ShowWindow(SW_SHOW);
	p->SetBitmap(hbmp);
	}

	else if(x>=269 && y>=173 && x<=298 && y<=197)
	{
		HBITMAP hbmp;	
	hbmp = (HBITMAP)::LoadImage(AfxFindResourceHandle(MAKEINTRESOURCE(IDB_BITMAP24), RT_GROUP_ICON),
		MAKEINTRESOURCE(IDB_BITMAP24), IMAGE_BITMAP, 0, 0, 0);

	CButton *p = (CButton *)GetDlgItem(IDC_BUTTON5);
	p->ShowWindow(SW_SHOW);
	p->SetBitmap(hbmp);
	}
	else if(x>=423 && y>=173 && x<=452&& y<=197)
	{
		HBITMAP hbmp;	
	hbmp = (HBITMAP)::LoadImage(AfxFindResourceHandle(MAKEINTRESOURCE(IDB_BITMAP22), RT_GROUP_ICON),
		MAKEINTRESOURCE(IDB_BITMAP22), IMAGE_BITMAP, 0, 0, 0);

	CButton *p = (CButton *)GetDlgItem(IDC_BUTTON6);
	p->ShowWindow(SW_SHOW);
	p->SetBitmap(hbmp);
	}
	else if(x>=575 && y>=173 && x<=600 && y<=197)
	{
		HBITMAP hbmp;	
	hbmp = (HBITMAP)::LoadImage(AfxFindResourceHandle(MAKEINTRESOURCE(IDB_BITMAP23), RT_GROUP_ICON),
		MAKEINTRESOURCE(IDB_BITMAP23), IMAGE_BITMAP, 0, 0, 0);

	CButton *p = (CButton *)GetDlgItem(IDCANCEL);
	p->ShowWindow(SW_SHOW);
	p->SetBitmap(hbmp);
	}
	else if(x>=426 && y>=263 && x<=459 && y<=289)
	{
		HBITMAP hbmp;	
	hbmp = (HBITMAP)::LoadImage(AfxFindResourceHandle(MAKEINTRESOURCE(IDB_BITMAP21), RT_GROUP_ICON),
		MAKEINTRESOURCE(IDB_BITMAP21), IMAGE_BITMAP, 0, 0, 0);

	CButton *p = (CButton *)GetDlgItem(IDC_BUTTON8);
	p->ShowWindow(SW_SHOW);
	p->SetBitmap(hbmp);
	}

	else
	{
		GetDlgItem(IDC_BUTTON1)->ShowWindow(SW_HIDE);		
		GetDlgItem(IDC_BUTTON2)->ShowWindow(SW_HIDE);
		GetDlgItem(IDC_BUTTON3)->ShowWindow(SW_HIDE);
		GetDlgItem(IDC_BUTTON4)->ShowWindow(SW_HIDE);
		GetDlgItem(IDC_BUTTON5)->ShowWindow(SW_HIDE);		
		GetDlgItem(IDC_BUTTON6)->ShowWindow(SW_HIDE);
		GetDlgItem(IDCANCEL)->ShowWindow(SW_HIDE);
		GetDlgItem(IDC_BUTTON8)->ShowWindow(SW_HIDE);
	}

	SetDlgItemInt(IDC_EDIT1, point.x);
	SetDlgItemInt(IDC_EDIT2, point.y);
	
	CDialog::OnMouseMove(nFlags, point);
}

void CBbbDlg::OnButton1() 
{
	// TODO: Add your control notification handler code here
	pdlgBaseInfoM = new CDlgBaseInfoM;
	pdlgBaseInfoM->DoModal();
	delete pdlgBaseInfoM;
	
}

void CBbbDlg::OnButton2() 
{
	// TODO: Add your control notification handler code here
	pdlgStoreInfoM = new CDlgStoreInfoM;
	pdlgStoreInfoM->DoModal();
	delete pdlgStoreInfoM;

	
}

void CBbbDlg::OnButton3() 
{
	// TODO: Add your control notification handler code here
	pdlgQueryM = new CDlgQueryM;
	pdlgQueryM->DoModal();
	delete pdlgQueryM;
	
}

void CBbbDlg::OnButton5() 
{
	// TODO: Add your control notification handler code here
	CDlgLogin dlg;
	dlg.DoModal();	
}

void CBbbDlg::OnButton6() 
{
	// TODO: Add your control notification handler code here
	pdlgBaseInfoM = new CDlgBaseInfoM(0);
	pdlgBaseInfoM->DoModal();
	delete pdlgBaseInfoM;
	
}

void CBbbDlg::OnOperatorM() 
{
	// TODO: Add your command handler code here
	pdlgBaseInfoM = new CDlgBaseInfoM(0);
	pdlgBaseInfoM->DoModal();
	delete pdlgBaseInfoM;	
}

void CBbbDlg::OnButton4() 
{
	// TODO: Add your control notification handler code here
	CDlgConfigM dlg;
	if (dlg.DoModal() == IDOK)
	{
		return;
	}
	
}

void CBbbDlg::OnTimer(UINT nIDEvent) 
{
	// TODO: Add your message handler code here and/or call default
	
	CDialog::OnTimer(nIDEvent);
}

void CBbbDlg::OnAboutbox() 
{
	// TODO: Add your command handler code here
	CAboutDlg dlg;
	dlg.DoModal();
	
}

void CBbbDlg::OnBookInfo() 
{
	// TODO: Add your command handler code here
	pdlgBaseInfoM = new CDlgBaseInfoM(1);
	pdlgBaseInfoM->DoModal();
	delete pdlgBaseInfoM;
	
}

void CBbbDlg::OnProviderInfo() 
{
	// TODO: Add your command handler code here
	pdlgBaseInfoM = new CDlgBaseInfoM(2);
	pdlgBaseInfoM->DoModal();
	delete pdlgBaseInfoM;
	
}

void CBbbDlg::OnBookType() 
{
	// TODO: Add your command handler code here
	pdlgBaseInfoM = new CDlgBaseInfoM(3);
	pdlgBaseInfoM->DoModal();
	delete pdlgBaseInfoM;
	
}

void CBbbDlg::OnCkInfo() 
{
	// TODO: Add your command handler code here
	pdlgBaseInfoM = new CDlgBaseInfoM(4);
	pdlgBaseInfoM->DoModal();
	delete pdlgBaseInfoM;
	
}

void CBbbDlg::OnDeskInfo() 
{
	// TODO: Add your command handler code here
	pdlgBaseInfoM = new CDlgBaseInfoM(5);
	pdlgBaseInfoM->DoModal();
	delete pdlgBaseInfoM;
	
}

void CBbbDlg::OnBookInput() 
{
	// TODO: Add your command handler code here
	pdlgStoreInfoM = new CDlgStoreInfoM(0);
	pdlgStoreInfoM->DoModal();
	delete pdlgStoreInfoM;
	
}

void CBbbDlg::OnBookPrice() 
{
	// TODO: Add your command handler code here
	pdlgStoreInfoM = new CDlgStoreInfoM(1);
	pdlgStoreInfoM->DoModal();
	delete pdlgStoreInfoM;
	
}

void CBbbDlg::OnBookPriceAdjust() 
{
	// TODO: Add your command handler code here
	pdlgStoreInfoM = new CDlgStoreInfoM(2);
	pdlgStoreInfoM->DoModal();
	delete pdlgStoreInfoM;
	
}

void CBbbDlg::OnInputBack() 
{
	// TODO: Add your command handler code here
	pdlgStoreInfoM = new CDlgStoreInfoM(3);
	pdlgStoreInfoM->DoModal();
	delete pdlgStoreInfoM;
	
}

void CBbbDlg::OnBookAdjust() 
{
	// TODO: Add your command handler code here
	pdlgStoreInfoM = new CDlgStoreInfoM(4);
	pdlgStoreInfoM->DoModal();
	delete pdlgStoreInfoM;
	
}

void CBbbDlg::OnSaleM() 
{
	// TODO: Add your command handler code here
	pdlgStoreInfoM = new CDlgStoreInfoM(5);
	pdlgStoreInfoM->DoModal();
	delete pdlgStoreInfoM;
	
}

void CBbbDlg::OnSaleBack() 
{
	// TODO: Add your command handler code here
	pdlgStoreInfoM = new CDlgStoreInfoM(6);
	pdlgStoreInfoM->DoModal();
	delete pdlgStoreInfoM;
	
}

void CBbbDlg::OnInputQuery() 
{
	// TODO: Add your command handler code here
	pdlgQueryM = new CDlgQueryM(0);
	pdlgQueryM->DoModal();
	delete pdlgQueryM;
	
}

void CBbbDlg::OnInputBackQuery() 
{
	// TODO: Add your command handler code here
	pdlgQueryM = new CDlgQueryM(1);
	pdlgQueryM->DoModal();
	delete pdlgQueryM;
	
}

void CBbbDlg::OnSaleQuery() 
{
	// TODO: Add your command handler code here
	pdlgQueryM = new CDlgQueryM(2);
	pdlgQueryM->DoModal();
	delete pdlgQueryM;
	
}

void CBbbDlg::OnSaleBackQuery() 
{
	// TODO: Add your command handler code here
	pdlgQueryM = new CDlgQueryM(3);
	pdlgQueryM->DoModal();
	delete pdlgQueryM;
	
}

void CBbbDlg::AdoInit()
{

}

void CBbbDlg::OnButton8() 
{
	// TODO: Add your control notification handler code here
	pdlgBaseInfoM = new CDlgBaseInfoM(0);
	pdlgBaseInfoM->DoModal();
	delete pdlgBaseInfoM;
	//enum
}

void CBbbDlg::OnOK()
{

}

void CBbbDlg::OnCancel()
{
	CDialog::OnCancel();
}

⌨️ 快捷键说明

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