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

📄 new.cpp

📁 RFID 的实用例子,登陆使用了标准动态库类
💻 CPP
字号:
// New.cpp : Defines the class behaviors for the application.
//

#include "stdafx.h"
#include "New.h"
#include "NewDlg.h"

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

#define nModual 23

/////////////////////////////////////////////////////////////////////////////
// CNewApp


COperDb OperDb;
CSelectItemInfo pSel;


CString m_strGEmployeeName;
CString m_strGEmployeeNo;
CString m_strGERight;




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

/////////////////////////////////////////////////////////////////////////////
// CNewApp construction

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

/////////////////////////////////////////////////////////////////////////////
// The one and only CNewApp object

CNewApp theApp;

/////////////////////////////////////////////////////////////////////////////
// CNewApp initialization

BOOL CNewApp::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

	OperDb.OpenDb();
	if (login())
	{
	    CNewDlg dlg(m_bRightNew, m_bRightDel,m_bRightEdit,m_bRightRequery,m_strGEmployeeNo,m_strGEmployeeName);
    	m_pMainWnd = &dlg;
	    int nResponse = dlg.DoModal();
	    if (nResponse == IDOK)
		{
		   // TODO: Place code here to handle when the dialog is
		   //  dismissed with OK
		}
	    else if (nResponse == IDCANCEL)
		{
		   // TODO: Place code here to handle when the dialog is
		   //  dismissed with Cancel
		}
	}

	OperDb.CloseDb();

	// Since the dialog has been closed, return FALSE so that we exit the
	//  application, rather than start the application's message pump.
	return FALSE;
}

BOOL CNewApp::login()
{

	int nResult;
	typedef int __stdcall  FINDRIGHT(BYTE,	CString &, CString &,CString &);
    FINDRIGHT *FindRight;
    HINSTANCE hm;
	int Modual = nModual;
    if(hm = ::LoadLibrary("Login.dll"))
	{
//		FindRight = ((FINDRIGHT *)(::GetProcAddress(hm,"FindRight")));
		FindRight = (FINDRIGHT *)::GetProcAddress(hm,"FindRight");
		if (FindRight)
		{
			nResult = FindRight(Modual, m_strGEmployeeName,m_strGEmployeeNo,m_strGERight);
		}
		else AfxMessageBox("something wrong");
	}
	else
	{
		AfxMessageBox("dll加载失败!");
	}

	
	if (atoi(m_strGERight) == 0)
	{
		AfxMessageBox("对不起,您没有进入该模块的权限!请与系统管理员联系。");
		return false;
	}
	

//right definition: (1)Requery(2)New(3)Edit	

	if (m_strGERight.Mid(0,1) == "1") 	m_bRightNew = true;
	if (m_strGERight.Mid(1,1) == "1") 	m_bRightDel = true;
	if (m_strGERight.Mid(2,1) == "1") 	m_bRightEdit = true;
	if (m_strGERight.Mid(3,1) == "1") 	m_bRightPrint = true;
    if (m_strGERight.Mid(4,1) == "1") 	m_bRightRequery = true;
	if (m_strGERight.Mid(5,1) == "1") 	m_bRightStart = true;
	if (m_strGERight.Mid(6,1) == "1") 	m_bRightStop = true;
    return true;

}

⌨️ 快捷键说明

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