www.gusucode.com > VC++超市进销存管理系统(Access)-源码程序 > VC++超市进销存管理系统(Access)-源码程序/code/NcShop/NCShop.cpp

    //Download by http://www.NewXing.com
// NCShop.cpp : Defines the class behaviors for the application.
//

#include "stdafx.h"
#include "NCShop.h"
#include "NCShopDlg.h"
#include "DlgLogo.h"
#include "DlgXiaoShouKanDan.h"
#include "ADOConn.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CNCShopApp

BEGIN_MESSAGE_MAP(CNCShopApp, CWinApp)
	//{{AFX_MSG_MAP(CNCShopApp)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG
	ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CNCShopApp construction

CNCShopApp::CNCShopApp()
{
	// TODO: add construction code here,
	// Place all significant initialization in InitInstance
}

/////////////////////////////////////////////////////////////////////////////
// The one and only CNCShopApp object

CNCShopApp theApp;

/////////////////////////////////////////////////////////////////////////////
// CNCShopApp initialization

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

	// 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
	ftButton.CreateFont(20,0,0,0,
	FW_BOLD,FALSE,FALSE,FALSE,
	ANSI_CHARSET,
	OUT_DEFAULT_PRECIS,
	CLIP_DEFAULT_PRECIS,
	DEFAULT_QUALITY,
	DEFAULT_PITCH|FF_MODERN,
	"MS Sans Serif");
	ftHeader.CreateFont(36,0,0,0,
	FW_NORMAL,FALSE,FALSE,FALSE,
	ANSI_CHARSET,
	OUT_DEFAULT_PRECIS,
	CLIP_DEFAULT_PRECIS,
	DEFAULT_QUALITY,
	DEFAULT_PITCH|FF_MODERN,
	"MS Sans Serif");
	ftPart.CreateFont(24,0,0,0,
	FW_NORMAL,FALSE,FALSE,FALSE,
	ANSI_CHARSET,
	OUT_DEFAULT_PRECIS,
	CLIP_DEFAULT_PRECIS,
	DEFAULT_QUALITY,
	DEFAULT_PITCH|FF_MODERN,
	"MS Sans Serif");
	ftReport.CreateFont(18,0,0,0,
	FW_NORMAL,FALSE,FALSE,FALSE,
	ANSI_CHARSET,
	OUT_DEFAULT_PRECIS,
	CLIP_DEFAULT_PRECIS,
	DEFAULT_QUALITY,
	DEFAULT_PITCH|FF_MODERN,
	"MS Sans Serif");
	ftBottom.CreateFont(10,0,0,0,
	FW_NORMAL,FALSE,FALSE,FALSE,
	ANSI_CHARSET,
	OUT_DEFAULT_PRECIS,
	CLIP_DEFAULT_PRECIS,
	DEFAULT_QUALITY,
	DEFAULT_PITCH|FF_MODERN,
	"MS Sans Serif");
	CDlgLogo dlgLog;
	CNCShopDlg dlg;
	CDlgXiaoShouKanDan dlgXiao;
	int i;
	CString strSql;
	CADOConn adoMain;
	if(dlgLog.DoModal()!=IDOK) ::exit(0);
	strSql="select * from 管理员基本信息表 where 编号='";
	strSql=strSql+dlgLog.strNo+"'";
	adoMain.Open(strSql);
	if(!adoMain.adoEOF())
	{
		if(adoMain.MoveFirst())
		{
			i=adoMain.GetValueInt(2);
			if(i==2)
			{
				m_pMainWnd = &dlgXiao;
				dlgXiao.DoModal();
			}
			else
			{
				dlg.strNo=dlgLog.strNo;
				dlg.strName=dlgLog.strName;
				m_pMainWnd = &dlg;
				dlg.DoModal();
			}
		}
	}
	// Since the dialog has been closed, return FALSE so that we exit the
	//  application, rather than start the application's message pump.
	return FALSE;
}
void CNCShopApp::OnSetPrinter()
{
	OnFilePrintSetup();
}