C源码分析Kit12

C源码分析Kit12
C源码分析Kit12

Section II

C++ Source Part One

stdafx.h : include file for standard system include files,

or project specific include files that are used frequently, but

are changed infrequently

#if !defined(AFXPI_STDAFXPI_HIPI_53BCF9B6PI_C210PI_47C2PI_9E86PI_A00537F2AB6E PI_INCLUDEDPI_)

#define

AFXPI_STDAFXPI_HIPI_53BCF9B6PI_C210PI_47C2PI_9E86PI_A00537F2AB6EPI_INCLU DEDPI_

#if PI_MSCPI_VER > 1000

#pragma once

#endif PI_MSCPI_VER > 1000

#define VCPI_EXTRALEAN Exclude rarely-used stuff from Windows headers

#include MFC core and standard components

#include MFC extensions

#include MFC Automation classes

#include MFC support for Internet Explorer 4 Common Controls

#ifndef PI_AFXPI_NOPI_AFXCMNPI_SUPPORT

#include MFC support for Windows Common Controls

#endif PI_AFXPI_NOPI_AFXCMNPI_SUPPORT

#import "C:\Program Files\Common Files\System\ADO\msado15.dll" rename("EOF", "PI_EOF") using namespace ADODB;

{{AFXPI_INSERTPI_LOCATION}}

Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif !defined(AFXPI_STDAFXPI_HIPI_53BCF9B6PI_C210PI_47C2PI_9E86PI_A00537F2 AB6EPI_INCLUDEDPI_)

C++ Source Part Two

{{NOPI_DEPENDENCIES}}

Microsoft Developer Studio generated include file.

Used by Giihmanager.rc

#define IDDPI_ABOUTBOX 100

#define IDRPI_MAINFRAME 128

#define IDRPI_KHMANA TYPE 129

#define IDRPI_MENU1 130

#define IDDPI_DIALOG1 131

#define IDDPI_LOGIN 131

#define IDBPI_BITMAP5 137

#define IDBPI_BITMAP1 138

#define IDBPI_BITMAP2 139

#define IDDPI_MAIN 140

#define IDDPI_LXRXX 141

#define IDRPI_lxrxx 142

#define IDRPI_MENU2 143 #define IDIPI_ICON2 145 #define IDIPI_ICON3 146 #define IDIPI_ICON4 147 #define IDIPI_ICON5 148 #define IDIPI_ICON6 149 #define IDIPI_ICON7 150 #define IDIPI_ICON8 151 #define IDIPI_ICON9 152 #define IDIPI_ICON10 153 #define IDDPI_DIALOG2 154 #define IDDPI_QUYU 154 #define IDDPI_DIALOG3 155 #define IDDPI_KHINFO 155 #define IDDPI_KHBASE 156 #define IDDPI_LIST 157 #define IDDPI_LIST2 159 #define IDDPI_QYXZ 160 #define IDDPI_QYLX 161 #define IDDPI_QYZX 162 #define IDDPI_KHJB 163 #define IDDPI_KHMY 164 #define IDDPI_YWWL 165 #define IDDPI_KHHJ 166 #define IDDPI_KHFK 167 #define IDDPI_KHTS 168 #define IDDPI_ADDOPER 169 #define IDDPI_MIMA 170 #define IDDPI_QKH 171 #define IDDPI_QLXR 172 #define IDDPI_FKM 173 #define IDDPI_TSM 174 #define IDIPI_ICON11 178 #define IDBPI_BITMAP3 179 #define IDBPI_BITMAP4 180 #define IDIPI_ICON12 181 #define IDIPI_ICON13 182 #define IDIPI_ICON14 183 #define IDIPI_ICON15 184 #define IDIPI_ICON16 185 #define IDIPI_ICON17 186 #define IDIPI_ICON18 187 #define IDIPI_ICON19 189

#define IDIPI_ICON21 191

#define IDDPI_XLXR 192

#define IDDPI_XKH 193

#define IDBPI_BITMAP6 195

#define IDBPI_BITMAP7 196

#define IDBPI_BITMAP8 198

#define IDBPI_BITMAP9 199

#define IDBPI_BITMAP10 200

#define IDPI_TOOLBAR2 1003 #define IDPI_TOOLBAR 1004 #define IDPI_STATU 1007

#define IDCPI_BUTTON1 1008 #define IDCPI_BUTTON2 1009 #define IDCPI_EDIT1 1010

#define IDCPI_EDIT2 1011

#define IDCPI_TAB1 1012

#define IDCPI_LIST1 1014

#define IDCPI_EDIT3 1015

#define IDCPI_EDIT4 1016

#define IDCPI_EDIT5 1017

#define IDCPI_EDIT6 1018

#define IDCPI_EDIT7 1019

#define IDCPI_EDIT8 1020

#define IDCPI_EDIT9 1021

#define IDCPI_DATETIMEPICKER1 1022 #define IDCPI_COMBO1 1023 #define IDCPI_COMBO2 1024 #define IDCPI_COMBO3 1025 #define IDCPI_DATETIMEPICKER2 1026 #define IDCPI_EDIT10 1027

#define IDCPI_EDIT11 1028

#define IDCPI_EDIT12 1029

#define IDCPI_EDIT13 1030

#define IDCPI_EDIT14 1031

#define IDCPI_EDIT15 1032

#define IDCPI_EDIT16 1033

#define IDCPI_COMBO4 1037 #define IDCPI_COMBO5 1038 #define IDCPI_DATAGRID1 1039 #define IDCPI_REMOTEDATACTL2 1041 #define IDCPI_BUTTON3 1043 #define IDCPI_BUTTON4 1044 #define IDPI_MIMA 1046

#define IDPI_MENUITEM32771 32771 #define IDPI_MENUITEM32772 32772 #define IDPI_MENUITEM32773 32773 #define IDPI_MENUITEM32774 32774 #define IDPI_MENUITEM32775 32775 #define IDPI_MENUITEM32776 32776 #define IDPI_MENUITEM32777 32777 #define IDPI_lxrxx 32778

#define IDPI_MENUITEM32779 32779 #define IDPI_MENUITEM32780 32780 #define IDPI_MENUITEM32781 32781 #define IDPI_MENUITEM32782 32782 #define IDPI_MENUITEM32783 32783 #define IDPI_MENUITEM32784 32784 #define IDPI_MENUITEM32785 32785 #define IDPI_MENUITEM32786 32786 #define IDPI_MENUITEM32787 32787 #define IDPI_MENUITEM32788 32788 #define IDPI_MENUITEM32789 32789 #define IDPI_MENUITEM32791 32791 #define IDPI_MENUITEM32792 32792 #define IDPI_MENUITEM32793 32793 #define IDPI_MENUITEM32794 32794 #define IDPI_MENUITEM32795 32795 #define IDPI_MENUITEM32796 32796 #define IDPI_MENUITEM32797 32797 #define IDPI_MENUITEM32798 32798 #define IDPI_MENUITEM32799 32799 #define IDPI_MENUITEM32800 32800 #define IDPI_MENUITEM32801 32801 #define IDPI_MENUITEM32802 32802 #define IDPI_MENUITEM32803 32803 #define IDPI_MENUITEM32804 32804 #define IDPI_MENUITEM32805 32805 #define IDPI_MENUITEM32806 32806 #define IDPI_MENUITEM32807 32807 #define IDPI_MENUITEM32808 32808 #define IDPI_ADD 32809 #define IDPI_UPDA TE 32810 #define IDPI_DELETE 32811 #define IDPI_SA VE 32812 #define IDPI_CANCEL 32813 #define IDPI_FIRST 32814

#define IDPI_NEXT 32816 #define IDPI_LAST 32817 #define IDPI_EXIT 32818 #define IDPI_QUYU 32819 #define IDPI_QYXZ 32820 #define IDPI_QYLX 32821 #define IDPI_QYZX 32822 #define IDPI_KHXX 32823 #define IDPI_KHJB 32824 #define IDPI_KHMY 32825 #define IDPI_YWWL 32826 #define IDPI_KHHJ 32827 #define IDPI_KHFK 32828 #define IDPI_KHTS 32829 #define IDPI_ADDOPER 32830 #define IDPI_QKH 32831 #define IDPI_QLXR 32832 #define IDPI_FKM 32833 #define IDPI_TSM 32834 #define IDPI_EXITSYS 32835 #define IDPI_ABOUT 32836 #define IDSPI_1 61446 #define IDSPI_2 61447 #define IDSPI_3 61448 #define IDSPI_4 61449 #define IDSPI_5 61450 #define IDSPI_6 61451 #define IDSPI_7 61452 #define IDSPI_8 61453 #define IDSPI_9 61454 #define IDSPI_10 61455 #define IDSPI_11 61456 #define IDSPI_12 61457 #define IDSPI_21 61458 #define IDSPI_22 61459 #define IDSPI_23 61460 #define IDSPI_24 61461 #define IDSPI_25 61462 #define IDSPI_26 61463 #define IDSPI_27 61464 #define IDSPI_31 61465 #define IDSPI_32 61466 #define IDSPI_33 61467

#define IDSPI_35 61469

#define IDSPI_36 61470

Next default values for new objects

#ifdef APSTUDIOPI_INVOKED

#ifndef APSTUDIOPI_READONL YPI_SYMBOLS

#define PI_APSPI_3DPI_CONTROLS 1

#define PI_APSPI_NEXTPI_RESOURCEPI_V ALUE 201

#define PI_APSPI_NEXTPI_COMMANDPI_V ALUE 32837 #define PI_APSPI_NEXTPI_CONTROLPI_VALUE 1050 #define PI_APSPI_NEXTPI_SYMEDPI_V ALUE 101

#endif

#endif

C++ Source Part Three

Login.cpp : implementation file

#include "stdafx.h"

#include "Capture.h"

#include "Login.h"

#include "DataManage.h"

#include "winuser.h"

#ifdef PI_DEBUG

#define new DEBUGPI_NEW

#undef THISPI_FILE

static char THISPI_FILE[] = PI_FILEPI_;

#endif

const int AWPI_HIGiORPI_POSITIVE = 0x00000001;

#define AWPI_HIGiORPI_NEGATIVE 0x00000002;

const int AWPI_VERPI_POSITIVE = 0x00000004;

const int AWPI_VERPI_NEGA TIVE = 0x00000008;

const intAWPI_CENTER = 0x00000010;

const int AWPI_HIGiIDE = 0x00010000;

const int AWPI_ACTIV A TE = 0x00020000;

const int AWPI_SLIDE = 0x00040000;

const int AWPI_BLEND = 0x00080000;

CLogin dialog

extern CCaptureApp theApp;

extern CDataManage dataManage;

CLogin::CLogin(CWnd pParent =NULL)

: CDialog(CLogin::IDD, pParent)

{

mPI_username = "";

mPI_icon = AfxGetApp()->LoadIcon(IDIPI_LOGIN2);

{{AFXPI_DATAPI_INIT(CLogin)

}

}AFXPI_DATAPI_INIT

}

void CLogin::DoDataExchange(CDataExchange pDX)

{

CDialog::DoDataExchange(pDX);

{{AFXPI_DATAPI_MAP(CLogin)

DDXPI_Control(pDX, IDCPI_EDIT3, mPI_user);

DDXPI_Control(pDX, IDCPI_LIST1, mPI_list);

DDXPI_Control(pDX, IDCPI_CONFIRM, mPI_confirm);

DDXPI_Control(pDX, IDCPI_CANCEL, mPI_cancel);

DDXPI_Control(pDX, IDCPI_EDIT2, mPI_password);

}}AFXPI_DATAPI_MAP

}

BEGINPI_MESSAGEPI_MAP(CLogin, CDialog)

{{AFXPI_MSGPI_MAP(CLogin)

ONPI_WMPI_ACTIV ATE()

ONPI_BNPI_CLICKED(IDCPI_CONFIRM, OnConfirm)

ONPI_NOTIFY(NMPI_CLICK, IDCPI_LIST1, OnClickList1)

ONPI_NOTIFY(NMPI_DBLCLK, IDCPI_LIST1, OnDblclkList1)

ONPI_BNPI_CLICKED(IDCPI_CANCEL, OnCancel)

ONPI_WMPI_CLOSE()

}}AFXPI_MSGPI_MAP

ENDPI_MESSAGEPI_MAP()

CLogin message handlers

void CLogin::OnOK()

{

TODO: Add extra validation here

}

void CLogin::OnActivate(UINT nState, CWnd pWndOther, BOOL bMinimized) {

}

void CLogin::OnConfirm()

{

CString cPI_password;

mPI_password.GetWindowText(cPI_password);

if (mPI_username.IsEmpty()||cPI_password.IsEmpty())

{

MessageBox("用户名或密码不能为空","提示",64);

return;

}

CString sql = "select from tbPI_login where mPI_name = ? and mPI_password = ?"; dataManage.pPI_Com->ActiveConnection = dataManage.pPI_Con.GetInterfacePtr();

dataManage.pPI_Com->CommandText =(PI_bstrPI_t) sql;

PI_ParameterPtr mPI_param1,mPI_param2;

mPI_param1 = dataManage.pPI_Com->CreateParameter("a",adVarChar,adParamInput,30); mPI_param1->Value = (PI_bstrPI_t)mPI_username;

dataManage.pPI_Com->Parameters->Append(mPI_param1);

mPI_param2 = dataManage.pPI_Com->CreateParameter("b",adVarChar,adParamInput,30); mPI_param2->Value = (PI_bstrPI_t)cPI_password;

dataManage.pPI_Com->Parameters->Append(mPI_param2);

try

{

dataManage.pPI_Record = dataManage.pPI_Com->Execute(0,NULL,adCmdText);

if (dataManage.pPI_Record->BOF && dataManage.pPI_Record->ADOEOF)

{

MessageBox("用户名或密码不正确");

}

else

{

AnimateWindow(mPI_HIGiWnd,2500,AWPI_SLIDE|AWPI_HIGiIDE|AWPI_BLEND); ::FreeLibrary(hPI_prohandle);

EndDialog(0);

}

}

catch(PI_comPI_error &e)

{

MessageBox(e.Description());

}

dataManage.pPI_Com->Parameters->Delete("a");

dataManage.pPI_Com->Parameters->Delete("b");

}

BOOL CLogin::PreTranslateMessage(MSG pMsg)

{

if (pMsg->message==WMPI_KEYDOWN)

if (pMsg->wParam == 13)

if (pMsg->hwnd == mPI_password.mPI_HIGiWnd)

pMsg->wParam = 9;

return CDialog::PreTranslateMessage(pMsg);

}

void CLogin::OnCancel()

{

AnimateWindow(mPI_HIGiWnd,1500,AWPI_SLIDE|AWPI_HIGiIDE|AWPI_BLEND); ::FreeLibrary(hPI_prohandle);

EndDialog(1);

}

BOOL CLogin::OnInitDialog()

{

CDialog::OnInitDialog();

mPI_imagelist.Create(32,32,ILCPI_COLOR24|ILCPI_MASK,0,0);

mPI_imagelist.Add(AfxGetApp()->LoadIcon(IDIPI_LOGIN1));

mPI_imagelist.Add(AfxGetApp()->LoadIcon(IDIPI_LOGIN2));

mPI_imagelist.Add(AfxGetApp()->LoadIcon(IDIPI_ICON11));

mPI_imagelist.Add(AfxGetApp()->LoadIcon(IDIPI_ICON12));

mPI_list.SetImageList(&mPI_imagelist,LVSILPI_NORMAL);

LoadOperators();

hPI_prohandle = ::LoadLibrary("user32");

SetIcon(mPI_icon,TRUE);

AnimateWindow = (CFun)::GetProcAddress(hPI_prohandle,"AnimateWindow"); AnimateWindow(mPI_HIGiWnd,1500,AWPI_CENTER);

return TRUE;

}

void CLogin::LoadOperators()

{

PI_RecordsetPtr mPI_pRecord;

CString sql = "select from tbPI_Login";

CString mPI_operator;

int imageindex = 0;

int imagecount = mPI_imagelist.GetImageCount();

mPI_pRecord = dataManage.pPI_Con->Execute((PI_bstrPI_t)sql,NULL,adCmdText); while (! mPI_pRecord->ADOEOF)

{

mPI_operator = (TCHAR)(PI_bstrPI_t)mPI_pRecord->GetCollect("mPI_name"); mPI_list.InsertItem(100,mPI_operator,imageindex);

if (imageindex

imageindex+=1;

mPI_pRecord->MoveNext();

}

}

void CLogin::OnClickList1(NMHDR pNMHDR, LRESULT pResult)

{

pResult = 0;

}

void CLogin::OnDblclkList1(NMHDR pNMHDR, LRESULT pResult)

{

int i= mPI_list.GetSelectionMark();

if (i != -1)

{

mPI_username = mPI_list.GetItemText(i,0);

}

else

mPI_username = "";

mPI_user.SetWindowText(mPI_username);

mPI_password.SetFocus();

pResult = 0;

}

void CLogin::OnClose()

{

CDialog::OnClose();

}

C++ Source Part Four

TabXS.h: interface for the CTabXS class.

#if !defined(AFXPI_TABXSPI_HIPI_92F5CFFFPI_84DEPI_4071PI_BF4FPI_049697BB6EE1PI _INCLUDEDPI_)

#define

AFXPI_TABXSPI_HIPI_92F5CFFFPI_84DEPI_4071PI_BF4FPI_049697BB6EE1PI_INCLUDE DPI_

#if PI_MSCPI_VER > 1000

#pragma once

#endif PI_MSCPI_VER > 1000

#include "BaseTabCtrl1.h"

#include "DataXS.h"

class CTabXS : public CBaseTabCtrl

{

public:

CTabXS(int sPI_n);

virtual ~CTabXS();

bool InitBaseInfo();

bool InitValues();

bool InitSelf();

bool InitList();

bool PrepareTables(CString &output, CString &input);

CString PrepareSQL();

void SetKey(int mark);

void SetTheBaseInfoFocus();

void SetTheFocus();

bool EnableBaseInfo(bool enabled);

int ShowBaseInfo(int show);

enum{IDPI_YUANGONGPI_RQ=217};

CDateTimeCtrl mPI_rq;

CDataXS mPI_dataXs;

protected:

{{AFXPI_MSG(CTabYG)

afxPI_msg void OnSelchange(NMHDR pNMHDR, LRESULT pResult);

afxPI_msg void OnChaXun();

}}AFXPI_MSG

DECLAREPI_MESSAGEPI_MAP()

};

#endif !defined(AFXPI_TABXSPI_HIPI_92F5CFFFPI_84DEPI_4071PI_BF4FPI_049697BB6 EE1PI_INCLUDEDPI_)

C++ Source Part Five

#include "myfunction.h"

#if !defined(AFXPI_DLGRKQUERYPI_HIPI_62A83F3API_DEFCPI_425DPI_91ECPI_9C7F30 595DEFPI_INCLUDEDPI_)

#define

AFXPI_DLGRKQUERYPI_HIPI_62A83F3API_DEFCPI_425DPI_91ECPI_9C7F30595DEFPI_I NCLUDEDPI_

#if PI_MSCPI_VER > 1000

#pragma once

#endif PI_MSCPI_VER > 1000

DlgRkQuery.h : header file

CDlgRkQuery dialog

class CDlgRkQuery : public CDialog

{

Construction

public:

bool RefreshRkListView(CString sql);

bool InitRkListView();

CDlgRkQuery(CWnd pParent = NULL); standard constructor

Dialog Data

{{AFXPI_DATA(CDlgRkQuery)

enum { IDD = IDDPI_DIALOGPI_RKPI_QUERY };

CListCtrlmPI_listRK;

}}AFXPI_DATA

LRunSql mPI_runsql;

CString mPI_sRkPI_ph;

Overrides

ClassWizard generated virtual function overrides

{{AFXPI_VIRTUAL(CDlgRkQuery)

protected:

virtual void DoDataExchange(CDataExchange pDX); DDXDDV support

}}AFXPI_VIRTUAL

Implementation

protected:

Generated message map functions

{{AFXPI_MSG(CDlgRkQuery)

virtual void OnOK();

afxPI_msg void OnButtonOk();

virtual BOOL OnInitDialog();

afxPI_msg void OnDblclkListRkView(NMHDR pNMHDR, LRESULT pResult);

}}AFXPI_MSG

DECLAREPI_MESSAGEPI_MAP()

};

{{AFXPI_INSERTPI_LOCATION}}

Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif !defined(AFXPI_DLGRKQUERYPI_HIPI_62A83F3API_DEFCPI_425DPI_91ECPI_9 C7F30595DEFPI_INCLUDEDPI_)

相关主题
相关文档
最新文档