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

📄 mc3000.cpp

📁 Symbol_MC3000_C#.条码扫码范例程序之5
💻 CPP
字号:
// mc3000.cpp : 定义应用程序的类行为。
//

#include "stdafx.h"
#include "mc3000.h"
#include "mc3000Dlg.h"
#include "LogDlg.h"
#include "DirectoryMG.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif


// Cmc3000App

BEGIN_MESSAGE_MAP(Cmc3000App, CWinApp)
END_MESSAGE_MAP()


// Cmc3000App 构造
Cmc3000App::Cmc3000App()
	: CWinApp()
{
	// TODO: 在此处添加构造代码,
	// 将所有重要的初始化放置在 InitInstance 中



}


// 唯一的一个 Cmc3000App 对象
Cmc3000App theApp;

// Cmc3000App 初始化

BOOL Cmc3000App::InitInstance()
{
#if defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP)
    // 在应用程序初始化期间,应调用一次 SHInitExtraControls 以初始化
    // 所有 Windows Mobile 特定控件,如 CAPEDIT 和 SIPPREF。
    SHInitExtraControls();
#endif // WIN32_PLATFORM_PSPC || WIN32_PLATFORM_WFSP

	// 标准初始化
	// 如果未使用这些功能并希望减小
	// 最终可执行文件的大小,则应移除下列
	// 不需要的特定初始化例程
	// 更改用于存储设置的注册表项
	// TODO: 应适当修改该字符串,
	// 例如修改为公司或组织名
	SetRegistryKey(_T("应用程序向导生成的本地应用程序"));

	m_bValid =IsValid();

	

	CFile  file;
	CString sFilePath = CDirectoryMG::GetLinceFilePath();
	SYSTEMTIME time;
	::GetLocalTime(&time);

#if 0
	if(file.Open(sFilePath,CFile::modeCreate|CFile::modeWrite))
	{
		file.Write(&time,sizeof(time));
	}
#endif
#if 1
	if(file.Open(sFilePath,CFile::modeRead))
	{
		SYSTEMTIME dwTime2;
		DWORD dwInterval;
		file.Read(&dwTime2,sizeof(time));
		if (time.wDay > (dwTime2.wDay + 2))
		{
			AfxMessageBox(_T("授权出错!"));
			return FALSE;
		}
	}

	if (file.m_hFile != CFile::hFileNull)
	{
		file.Close();
	}

#endif


	LogDlg *pdlgLogging = new LogDlg(m_bValid);
	if (pdlgLogging->DoModal() == IDCANCEL)
	{
		return FALSE;
	}
	delete pdlgLogging;
	pdlgLogging = NULL;

	Cmc3000Dlg dlg;
	m_pMainWnd = &dlg;
	INT_PTR nResponse = dlg.DoModal();
	if (nResponse == IDOK)
	{
		// TODO: 在此处放置处理何时用“确定”来关闭
		//  对话框的代码
	}

	// 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序,
	//  而不是启动应用程序的消息泵。
	return FALSE;
}

BOOL Cmc3000App::IsValid()
{
	CFile file;
	CString sFilePath =L"\\Windows\\goblin.dll";
	bool bres = false;

#if 0
	if (file.Open(sFilePath,CFile::modeCreate|CFile::modeWrite))
	{
		WCHAR cLince[MAXCHAR] = L"superman0564@263.net";
		file.Write(&cLince,sizeof(cLince));
	}
#endif
#if 1
	if (file.Open(sFilePath,CFile::modeRead))
	{
		WCHAR cLince[MAXCHAR];
		cLince[MAXCHAR - 1] = 0;
		file.Read(&cLince,sizeof(cLince));
		cLince[MAXCHAR - 1] = 0;

		CString sss = cLince;
		if (sss.Trim().CompareNoCase(L"superman0564@263.net") == 0)
		{
			bres = TRUE;
		}
	}
#endif
	if (file.m_hFile != CFile::hFileNull)
	{
		file.Close();
	}

	return bres;
}

⌨️ 快捷键说明

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