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

📄 dbegin.cpp

📁 用VC+SQL实现的物流管理系统 “RxMediaPlayer” 文件夹中存放《物流综合管理系统》中《媒体播放平台》源程序 “数据库设置”文件夹中存放《物流综合管理系统》辅助工具《数据库设置》源程
💻 CPP
字号:
// DBegin.cpp : implementation file
//

#include "stdafx.h"
#include "MyProject.h"
#include "DBegin.h"
#include "DLogin.h"
#include "DRegedit.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CDBegin dialog


CDBegin::CDBegin(CWnd* pParent /*=NULL*/)
	: CDialog(CDBegin::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDBegin)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CDBegin::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDBegin)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDBegin, CDialog)
	//{{AFX_MSG_MAP(CDBegin)
	ON_WM_TIMER()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDBegin message handlers

void CDBegin::OnOK() 
{
	// TODO: Add extra validation here
	
	//CDialog::OnOK();
}

void CDBegin::OnTimer(UINT nIDEvent) 
{
	CDialog::OnTimer(nIDEvent);
	this->KillTimer(1);
	this->OnCancel();

	//判断是否注册
	char cPath[_MAX_DIR];
	CString sName,sCode,sPath;
	::GetSystemDirectory(cPath,sizeof(cPath));
	sPath.Format("%s\\SYSRX.ini",cPath);

	::GetPrivateProfileString("ENROL","NAME",NULL,sName.GetBuffer(128),128,sPath);
	::GetPrivateProfileString("ENROL","CODE",NULL,sCode.GetBuffer(128),128,sPath);
	CString cStrCode,cStrName;
	cStrCode.Format("%s",sCode);
	cStrName.Format("%s",sName);
	if(cStrCode.IsEmpty()==true || cStrName.IsEmpty()==true)
	{
		//还没有注册
		CDRegedit dlg;
		dlg.DoModal();
	}
	else
	{
		//验证合法性
		for(int i=1;i<cStrCode.GetLength();i++)
		{
			if(cStrCode.Mid(i,1)=="-")
				cStrCode.Delete(i);
		}
		char * cNameCode=cStrName.GetBuffer(cStrName.GetLength());
		DWORD dNameCode=*cNameCode;
		int nMaiCode=atoi(cStrCode)^dNameCode;
		//取得机器码(C盘序列号)
		LPCTSTR lpRootPathName="C:\\";
		LPTSTR lpVolumeNameBuffer=new char[12];
		DWORD nVolumnNameSize=12;
		DWORD MaximumComponentLength;
		DWORD VolumnSerialNumber;
		DWORD FileSystemFlags;
		LPTSTR lpFileSystemNameBuffer=new char[10];
		DWORD FileSystemNameLength=12;
		GetVolumeInformation(lpRootPathName,lpVolumeNameBuffer,nVolumnNameSize,&VolumnSerialNumber,&MaximumComponentLength,&FileSystemFlags,lpFileSystemNameBuffer,FileSystemNameLength);
		delete(lpVolumeNameBuffer);
		delete(lpFileSystemNameBuffer);
		if(VolumnSerialNumber==nMaiCode) //验证通过
		{
			p_Try=true;
			CDLogin dlg;
			dlg.DoModal();
		}
		else
		{
			CDRegedit dlg;
			dlg.DoModal();
		}
	}
}

BOOL CDBegin::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	this->SetTimer(1,1400,NULL);	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

⌨️ 快捷键说明

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