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

📄 atm.cpp

📁 本程序是利用com原理开发的一个ATM机与银行之间的分布式应用
💻 CPP
字号:
// ATM.cpp : Defines the class behaviors for the application.
//

#include "stdafx.h"
#include "ATM.h"
#include "ATMDlg.h"
#include "DlgLogin.h"

#include <objbase.h>

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



const IID IID_IAccount = {0x7354C409,0xF375,0x474F,{0xAA,0x74,0x25,0x78,0x6D,0x7B,0x55,0xD4}};
const IID LIBID_BANKLib = {0xFA43A1FD,0x3973,0x4EE1,{0x80,0x16,0x75,0x25,0x97,0x77,0x31,0xCF}};
const CLSID CLSID_Account = {0x820DEDC2,0xD384,0x471B,{0x9B,0x81,0xDE,0x71,0xEE,0x7C,0xC9,0x74}};

extern BOOL g_IsAccountValid;
/////////////////////////////////////////////////////////////////////////////
// CATMApp

BEGIN_MESSAGE_MAP(CATMApp, CWinApp)
	//{{AFX_MSG_MAP(CATMApp)
		// 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()

/////////////////////////////////////////////////////////////////////////////
// CATMApp construction

CATMApp::CATMApp()
{
}

/////////////////////////////////////////////////////////////////////////////
// The one and only CATMApp object

CATMApp theApp;

/////////////////////////////////////////////////////////////////////////////
// CATMApp initialization

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

#ifdef _AFXDLL
	Enable3dControls();			// Call this when using MFC in a shared DLL
#else
	Enable3dControlsStatic();	// Call this when linking to MFC statically
#endif
	
	HRESULT		hr;
	hr =CoInitialize(NULL);    //初始化COM

	hr =CoInitializeSecurity(NULL, -1, NULL, NULL,RPC_C_AUTHN_LEVEL_NONE,  //安全初始化
		                 RPC_C_IMP_LEVEL_IMPERSONATE,NULL,  EOAC_NONE, NULL);
	if(hr!=0)
		AfxMessageBox("COM初始化出错!");

    CDlgLogin dlg;
	dlg.DoModal();
	if(g_IsAccountValid)
	{
		CATMDlg dlg1;
		dlg1.DoModal();
	    return TRUE;
	}
    else
	{
		AfxMessageBox("帐户或密码有误!");
	    return FALSE;
	}
}

int CATMApp::ExitInstance() 
{
	if(hr==0)	
	   CoUninitialize();  

	return CWinApp::ExitInstance();
}

⌨️ 快捷键说明

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