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

📄 aaa.cpp

📁 主要功能 企业仓库管理系统由基本信息管理模块、入库管理模块、库存管理模块、查询管理模块等几部分组成。 &#61553 基本信息管理模块 该模块主要包括操作员管理、商品信息管理、库存信息管理、供
💻 CPP
字号:
// aaa.cpp : Defines the class behaviors for the application.
//

#include "stdafx.h"
#include "aaa.h"

#include "MainFrm.h"
#include "aaaDoc.h"
#include "LeftView.h"
#include "DlgLogin.h"
#include "AaaView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CAaaApp

BEGIN_MESSAGE_MAP(CAaaApp, CWinApp)
	//{{AFX_MSG_MAP(CAaaApp)
	ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}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()

/////////////////////////////////////////////////////////////////////////////
// CAaaApp construction

CAaaApp::CAaaApp()
{
	memset(m_pzServer, 0, 128);
	memset(m_pzDataBase, 0, 128);
	memset(m_pzUser, 0, 128);
	memset(m_pzPassWord, 0, 128);	
	iLevel = 0;
	// TODO: add construction code here,
	// Place all significant initialization in InitInstance
}

/////////////////////////////////////////////////////////////////////////////
// The one and only CAaaApp object

CAaaApp theApp;

/////////////////////////////////////////////////////////////////////////////
// CAaaApp initialization

BOOL CAaaApp::InitInstance()
{

	AfxOleInit();  //OLE 初始化

	AfxEnableControlContainer();

#ifdef _AFXDLL
	Enable3dControls();			// Call this when using MFC in a shared DLL
#else
	Enable3dControlsStatic();	// Call this when linking to MFC statically
#endif
	SetRegistryKey(_T("Local AppWizard-Generated Applications"));

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

	// Register the application's document templates.  Document templates
	//  serve as the connection between documents, frame windows and views.

	CSingleDocTemplate* pDocTemplate;
	pDocTemplate = new CSingleDocTemplate(
		IDR_MAINFRAME,
		RUNTIME_CLASS(CAaaDoc),
		RUNTIME_CLASS(CMainFrame),       // main SDI frame window
		RUNTIME_CLASS(CLeftView));
	AddDocTemplate(pDocTemplate);
	
	// Parse command line for standard shell commands, DDE, file open
	CCommandLineInfo cmdInfo;
	ParseCommandLine(cmdInfo);

	 //Dispatch commands specified on the command line
	if (!ProcessShellCommand(cmdInfo))
		return FALSE;

	m_pMainWnd->SetWindowText("企业仓库管理系统");	
//	m_pMainWnd->ShowWindow(SW_SHOWMAXIMIZED);
	m_pMainWnd->UpdateWindow();	

	//读配置文件
	GetPrivateProfileString("OPTION", "Server", "", m_pzServer,
		sizeof(m_pzServer), "./Login.ini") ;
	GetPrivateProfileString("OPTION", "DataBase", "", m_pzDataBase,
		sizeof(m_pzDataBase), "./Login.ini") ;
	GetPrivateProfileString("OPTION", "UserId", "", m_pzUser,
		sizeof(m_pzUser), "./Login.ini") ;
	GetPrivateProfileString("OPTION", "PassWord", "", m_pzPassWord,
		sizeof(m_pzPassWord), "./Login.ini") ;
	strAdoConn.Format("driver={SQL Server};SERVER=%s;UID=%s;PWD=%s;DATABASE=%s", 
	m_pzServer, m_pzUser, m_pzPassWord, m_pzDataBase);
	if (m_pzServer[0] == 0 || m_pzDataBase[0] == 0 || m_pzUser[0]==0)
	{
		::MessageBox(NULL, "请您检查配置文件(Login.ini)!",
			"配置文件错误", MB_ICONERROR);
		return FALSE();		
	}
	//显示登录对话框
	CDlgLogin dlg;
	if (dlg.DoModal() != IDOK)
	{
		return FALSE;
	}	

	if (dlg.strUser.IsEmpty() || dlg.strPassWord.IsEmpty())
	{
		::MessageBox(NULL, "Unhandle exception in aaa.exe (MFC42D,DLL): 0xC0000005: Access Violation",
			"Microsoft Visual C++", MB_ICONASTERISK);
		::MessageBox(NULL, "操作员名称或密码错误\n\n请您重新登录!",
			"登录错误", MB_ICONERROR);
		return FALSE;
	}

	this->strUser = dlg.strUser;
	this->strPassWord = dlg.strPassWord;	
	
	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 CAaaApp::OnAppAbout()
{
	CAboutDlg aboutDlg;
	aboutDlg.DoModal();
}

/////////////////////////////////////////////////////////////////////////////
// CAaaApp message handlers


int CAaaApp::ExitInstance() 
{

	// TODO: Add your specialized code here and/or call the base class
	//delete (m_pMainWnd);
	return CWinApp::ExitInstance();
}

⌨️ 快捷键说明

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