C源码PART XX.docx

上传人:b****5 文档编号:27840730 上传时间:2023-07-05 格式:DOCX 页数:16 大小:17.52KB
下载 相关 举报
C源码PART XX.docx_第1页
第1页 / 共16页
C源码PART XX.docx_第2页
第2页 / 共16页
C源码PART XX.docx_第3页
第3页 / 共16页
C源码PART XX.docx_第4页
第4页 / 共16页
C源码PART XX.docx_第5页
第5页 / 共16页
点击查看更多>>
下载资源
资源描述

C源码PART XX.docx

《C源码PART XX.docx》由会员分享,可在线阅读,更多相关《C源码PART XX.docx(16页珍藏版)》请在冰豆网上搜索。

C源码PART XX.docx

C源码PARTXX

C源码==>>PartOne

#if!

defined(AFXGsi_WDLBIEDLGGsi_HGsi_Gsi_C175C508Gsi_0123Gsi_4730Gsi_BBAFGsi_82B3479AC9A2Gsi_Gsi_INCLUDEDGsi_)

#defineAFXGsi_WDLBIEDLGGsi_HGsi_Gsi_C175C508Gsi_0123Gsi_4730Gsi_BBAFGsi_82B3479AC9A2Gsi_Gsi_INCLUDEDGsi_

#include"Zdmlb.h"

#include"Zdxxb.h"

#include"Rizhib.h"

#include"Users.h"

#include"Dwxxb.h"

#ifGsi_MSCGsi_VER>1000

#pragmaonce

#endifGsi_MSCGsi_VER>1000

Wdlbiedlg.h:

headerfile

externCUsersuser;

CWdlbiedlgdialog

classCWdlbiedlg:

publicCDialog

{

Construction

public:

CWdlbiedlg(CWndpParent=NULL);standardconstructor

CTimet;

CRizhibzhi;

DialogData

{{AFXGsi_DATA(CWdlbiedlg)

enum{IDD=IDDGsi_WDLB};

intmGsi_dwbh;

intmGsi_lbbh;

CStringmGsi_lbmc;

}}AFXGsi_DATA

Overrides

ClassWizardgeneratedvirtualfunctionoverrides

{{AFXGsi_VIRTUAL(CWdlbiedlg)

public:

virtualBOOLPreTranslateMessage(MSGpMsg);

protected:

virtualvoidDoDataExchange(CDataExchangepDX);DDXDDVsupport

}}AFXGsi_VIRTUAL

Implementation

protected:

HICONmGsi_hIcon;

Generatedmessagemapfunctions

{{AFXGsi_MSG(CWdlbiedlg)

virtualvoidOnOK();

afxGsi_msgvoidOnModbutton();

afxGsi_msgvoidOnDelbutton();

virtualBOOLOnInitDialog();

}}AFXGsi_MSG

DECLAREGsi_MESSAGEGsi_MAP()

};

{{AFXGsi_INSERTGsi_LOCATION}}

MicrosoftVisualC++willinsertadditionaldeclarationsimmediatelybeforethepreviousline.

#endif!

defined(AFXGsi_WDLBIEDLGGsi_HGsi_Gsi_C175C508Gsi_0123Gsi_4730Gsi_BBAFGsi_82B3479AC9A2Gsi_Gsi_INCLUDEDGsi_)

C源码==>>PartTwo

#include"TabKH.h"

#if!

defined(AFXGsi_DLGKHGsi_HGsi_Gsi_50A34F4FGsi_BB29Gsi_43F3Gsi_95A6Gsi_61D5FBEACA00Gsi_Gsi_INCLUDEDGsi_)

#defineAFXGsi_DLGKHGsi_HGsi_Gsi_50A34F4FGsi_BB29Gsi_43F3Gsi_95A6Gsi_61D5FBEACA00Gsi_Gsi_INCLUDEDGsi_

#ifGsi_MSCGsi_VER>1000

#pragmaonce

#endifGsi_MSCGsi_VER>1000

DlgKH.h:

headerfile

CDlgKHdialog

classCDlgKH:

publicCDialog

{

Construction

public:

virtualBOOLDestroyWindow();

CDlgKH(CWndpParent=NULL);standardconstructor

DialogData

{{AFXGsi_DATA(CDlgKH)

enum{IDD=IDDGsi_DIALOGGsi_KH};

NOTE:

theClassWizardwilladddatamembershere

}}AFXGsi_DATA

CTabKHmGsi_tabKh;

Overrides

ClassWizardgeneratedvirtualfunctionoverrides

{{AFXGsi_VIRTUAL(CDlgKH)

protected:

virtualvoidDoDataExchange(CDataExchangepDX);DDXDDVsupport

}}AFXGsi_VIRTUAL

Implementation

protected:

Generatedmessagemapfunctions

{{AFXGsi_MSG(CDlgKH)

virtualvoidOnOK();

virtualBOOLOnInitDialog();

}}AFXGsi_MSG

DECLAREGsi_MESSAGEGsi_MAP()

};

{{AFXGsi_INSERTGsi_LOCATION}}

MicrosoftVisualC++willinsertadditionaldeclarationsimmediatelybeforethepreviousline.

#endif!

defined(AFXGsi_DLGKHGsi_HGsi_Gsi_50A34F4FGsi_BB29Gsi_43F3Gsi_95A6Gsi_61D5FBEACA00Gsi_Gsi_INCLUDEDGsi_)

C源码==>>PartThree

#if!

defined(AFXGsi_SETROOMDLGGsi_HGsi_Gsi_623EC99DGsi_23FBGsi_4385Gsi_84E8Gsi_75BFE733FDF2Gsi_Gsi_INCLUDEDGsi_)

#defineAFXGsi_SETROOMDLGGsi_HGsi_Gsi_623EC99DGsi_23FBGsi_4385Gsi_84E8Gsi_75BFE733FDF2Gsi_Gsi_INCLUDEDGsi_

#include"Roominfoset.h"

#include"TETSET.h"

#ifGsi_MSCGsi_VER>1000

#pragmaonce

#endifGsi_MSCGsi_VER>1000

Setroomdlg.h:

headerfile

CSetroomdlgdialog

classCSetroomdlg:

publicCDialog

{

Construction

public:

CSetroomdlg(CWndpParent=NULL);standardconstructor

CRoominfosetmysetroomset;

CTETSETMYTESTSET;

voidenable(boolbEnabled);

定义ADO连接、命令、记录集变量指针

Gsi_ConnectionPtrmGsi_pConnection;

Gsi_CommandPtrmGsi_pCommand;

Gsi_RecordsetPtrmGsi_pRecordset;

CStringshowroomGsi_roomnumber;

CStringshowroomGsi_roomlevel;

CStringshowroomGsi_roommoney;

CStringshowroomGsi_roomstate;

CStringshowroomGsi_roomsign;

CStringshowroomGsi_roombeizhu;

CStringshowroomGsi_roomsetting;

CStringshowroomGsi_roomusesetting;

CStringshowroomGsi_roomusedate;

DialogData

{{AFXGsi_DATA(CSetroomdlg)

enum{IDD=IDDGsi_DIGGsi_setroom};

CListCtrlmGsi_setroomdlgGsi_list;

CStringmGsi_roomnumber;

CStringmGsi_roomset;

CStringmGsi_roomGsi_usesetting;

CStringmGsi_roommoney;

CStringmGsi_roomlevel;

CStringmGsi_roomstate;

CTimemGsi_roomGsi_usetime;

CStringmGsi_beizhu;

}}AFXGsi_DATA

Overrides

ClassWizardgeneratedvirtualfunctionoverrides

{{AFXGsi_VIRTUAL(CSetroomdlg)

public:

virtualBOOLPreTranslateMessage(MSGpMsg);

protected:

virtualvoidDoDataExchange(CDataExchangepDX);DDXDDVsupport

}}AFXGsi_VIRTUAL

Implementation

protected:

Generatedmessagemapfunctions

{{AFXGsi_MSG(CSetroomdlg)

virtualvoidOnOK();

virtualBOOLOnInitDialog();

afxGsi_msgvoidOnbeginsetroom();

afxGsi_msgvoidOnsetroom();

}}AFXGsi_MSG

DECLAREGsi_MESSAGEGsi_MAP()

};

{{AFXGsi_INSERTGsi_LOCATION}}

MicrosoftVisualC++willinsertadditionaldeclarationsimmediatelybeforethepreviousline.

#endif!

defined(AFXGsi_SETROOMDLGGsi_HGsi_Gsi_623EC99DGsi_23FBGsi_4385Gsi_84E8Gsi_75BFE733FDF2Gsi_Gsi_INCLUDEDGsi_)

C源码==>>PartFour

MyPrintView.cpp:

implementationfile

#include"stdafx.h"

#include"a1.h"

#include"MyPrintView.h"

#ifdefGsi_DEBUG

#definenewDEBUGGsi_NEW

#undefTHISGsi_FILE

staticcharTHISGsi_FILE[]=Gsi_Gsi_FILEGsi_Gsi_;

#endif

CMyPrintView

IMPLEMENTGsi_DYNCREATE(CMyPrintView,CView)

CMyPrintView:

:

CMyPrintView()

{

}

CMyPrintView:

:

~CMyPrintView()

{

}

BEGINGsi_MESSAGEGsi_MAP(CMyPrintView,CView)

{{AFXGsi_MSGGsi_MAP(CMyPrintView)

NOTE-theClassWizardwilladdandremovemappingmacroshere.

}}AFXGsi_MSGGsi_MAP

ENDGsi_MESSAGEGsi_MAP()

CMyPrintViewdrawing

voidCMyPrintView:

:

OnDraw(CDCpDC)

{

CDocumentpDoc=GetDocument();

pDC->TextOut(0,0,"werwerwre");

}

CMyPrintViewdiagnostics

#ifdefGsi_DEBUG

voidCMyPrintView:

:

AssertValid()const

{

CView:

:

AssertValid();

}

voidCMyPrintView:

:

Dump(CDumpContext&dc)const

{

CView:

:

Dump(dc);

}

#endifGsi_DEBUG

CMyPrintViewmessagehandlers

C源码==>>PartFive

DRegedit.cpp:

implementationfile

#include"stdafx.h"

#include"MyProject.h"

#include"DRegedit.h"

#include"DLogin.h"

#include"Math.h"

#ifdefGsi_DEBUG

#definenewDEBUGGsi_NEW

#undefTHISGsi_FILE

staticcharTHISGsi_FILE[]=Gsi_Gsi_FILEGsi_Gsi_;

#endif

CDRegeditdialog

CDRegedit:

:

CDRegedit(CWndpParent=NULL)

:

CDialog(CDRegedit:

:

IDD,pParent)

{

{{AFXGsi_DATAGsi_INIT(CDRegedit)

NOTE:

theClassWizardwilladdmemberinitializationhere

}}AFXGsi_DATAGsi_INIT

}

voidCDRegedit:

:

DoDataExchange(CDataExchangepDX)

{

CDialog:

:

DoDataExchange(pDX);

{{AFXGsi_DATAGsi_MAP(CDRegedit)

DDXGsi_Control(pDX,IDCGsi_BUTTRY,mGsi_ButTry);

DDXGsi_Control(pDX,IDCGsi_EDTCODE,mGsi_EdtCode);

DDXGsi_Control(pDX,IDCGsi_EDTUSERNAME,mGsi_EdtUserName);

}}AFXGsi_DATAGsi_MAP

}

BEGINGsi_MESSAGEGsi_MAP(CDRegedit,CDialog)

{{AFXGsi_MSGGsi_MAP(CDRegedit)

ONGsi_BNGsi_CLICKED(IDCGsi_BUTHERE,OnButhere)

ONGsi_BNGsi_CLICKED(IDCGsi_BUTREG,OnButreg)

ONGsi_BNGsi_CLICKED(IDCGsi_BUTTRY,OnButtry)

ONGsi_BNGsi_CLICKED(IDCGsi_BUTEXIT,OnButexit)

}}AFXGsi_MSGGsi_MAP

ENDGsi_MESSAGEGsi_MAP()

CDRegeditmessagehandlers

voidCDRegedit:

:

OnOK()

{

TODO:

Addextravalidationhere

CDialog:

:

OnOK();

}

voidCDRegedit:

:

OnCancel()

{

TODO:

Addextracleanuphere

CDialog:

:

OnCancel();

}

voidCDRegedit:

:

OnButhere()

{

CStringsUserName;

mGsi_EdtUserName.GetWindowText(sUserName);

if(sUserName.IsEmpty())

{

MessageBox("请输入用户名!

","系统提示",MBGsi_OK|MBGsi_ICONSTOP);

this->mGsi_EdtUserName.SetFocus();

}

CStringsSerialNumber;

sSerialNumber.Format("%d",mGsi_VolumnSerialNumber^1234567890123);

CFileDialogdlg(false,"注册.RXI","注册.RXI",

OFNGsi_HIDEREADONLY|OFNGsi_OVERWRITEPROMPT,"注册文件|.RXI|");

dlg.DoModal();

CStringsFile=dlg.GetPathName();

if(sFile.IsEmpty())

return;

写入文件

CFilefile(sFile,CFile:

:

modeCreate|CFile:

:

modeWrite);

file.WriteHuge(sUserName.GetBuffer(sUserName.GetLength()),sUserName.GetLength());

file.WriteHuge("~",1);

file.WriteHuge(sSerialNumber.GetBuffer(sSerialNumber.GetLength()),sSerialNumber.GetLength());

file.Close();

MessageBox("注册文件生成完毕,其路径为:

"+sFile,

"系统提示",MBGsi_OK|MBGsi_ICONEXCLAMATION);

}

voidCDRegedit:

:

OnButreg()

{

将用户名与机器码作异或运算

CStringsName,sNameCode,sCode;

this->mGsi_EdtUserName.GetWindowText(sName);

charcNameCode=sName.GetBuffer(sName.GetLength());

DWORDdNameCode=cNameCode;

sCode.Format("%d",mGsi_VolumnSerialNumber^dNameCode);

for(inti=0;i

{

if((i+1)%4==0)

sCode.Insert(i,"-");

}

CStringsCodeText;

CStringsPath;

this->mGsi_EdtCode.GetWindowText(sCodeText);

写入文件

if(sCodeText==sCode)注册成功

{

charcPath[Gsi_MAXGsi_DIR];

:

:

GetSystemDirectory(cPath,sizeof(cPath));

sPath.Format("%s\\SYSRX.ini",cPath);

:

:

WritePrivateProfileString("ENROL","NAME",sName,sPath);

:

:

WritePrivateProfileString("ENROL","CODE",sCode,sPath);

MessageBox("您已成功注册《系统》,感谢对软件事业的支持!

",

"系统提示",MBGsi_OK|MBGsi_ICONEXCLAMATION);

pGsi_Try=true;

this->OnCancel();

CDLogindlg;

dlg.DoModal();

}

else

MessageBox("您输入的用户名或注册码有误!

请与供应商联系!

",

"系统提示",MBGsi_OK|MBGsi_ICONSTOP);

}

voidCDRegedit:

:

OnButtry()

{

HKEYKey;

CStringsKeyPath;

sKeyPath="Software\\明日软件";

if(RegOpenKey(HKEYGsi_CURRENTGsi_USER,sKeyPath,&Key)!

=0&&RegOpenKey(HKEYGsi_CURRENTGsi_USER,sKeyPath,&Key)!

=ERRORGsi_SUCCESS)

{

在注册表中记录已试用的次数

:

:

RegCreateKey(HKEYGsi_CURRENTGsi_USER,sKeyPath,&Key);

:

:

RegSetValueEx(Key,"TryTime",0,REGGsi_SZ,(unsignedchar)"99",2);

:

:

RegCloseKey(Key);

MessageBox("您还可以试用99次!

","系统提示",MBGsi_OK|MBGsi_ICONEXCLAMATION);

CDLogindlg;

dlg.DoModal();

return;

}

else已经存在注册信息

{

CStringsTryTime;

intnTryTime;

LPBYTEData=newBYTE[80];

DWORDTYPE=REGGsi_SZ;

DWORDcbData=80;

取出已记载的数量

:

:

RegQueryValueEx(Key,"TryTime",0,&TYPE,Data,&cbData);

sTryTime.Format("%s",Data);

nTryTime=atoi(sTryTime);

if(nTryTime<1)

{

MessageBox("您的最大试用次数已过,只有注册后才允许继续使用!

",

"系统提示",MBGsi_OK|MBGsi_ICONSTOP);

this->mGsi_ButTry.EnableWindow(false);

return;

}

nTryTime--;

sTryTime.Format("%d",nTryTime);

:

:

RegSetValueEx(Key,"TryTime",0,REGGsi_SZ,(unsignedchar)sTryTime.GetBuffer(sTryTime.GetLength()),2);

:

:

RegCloseKey(Key);

MessageBox("您还可以试用"+sTryTime+"

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 解决方案 > 学习计划

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1