C++开发源码分析(0702)

?C++开发源码分析(0702)
C++ Source Part One
#if !defined(AFX_RXSTATIC_H__70E9FD6D_E341_41D9_B347_A09A3AA868C3__INCLUDED_)
#define AFX_RXSTATIC_H__70E9FD6D_E341_41D9_B347_A09A3AA868C3__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif _MSC_VER > 1000
RxStatic.h : header file
RxStatic window
class RxStatic : public CStatic
{
Construction
public:
RxStatic(COLORREF TextColor=RGB(255,255,255),COLORREF ShadowColor=RGB(0,0,0));
Attributes
public:
Operations
public:
Overrides
ClassWizard generated virtual function overrides
{{AFX_VIRTUAL(RxStatic)
protected:
virtual void PreSubclassWindow();
}}AFX_VIRTUAL
Implementation
public:
COLORREF GetShadowColor();
void SetShadowColor(COLORREF newColor);
COLORREF GetTextColor();
void SetTextColor(COLORREF newColor);
virtual ~RxStatic();
Generated message map functions
protected:
{{AFX_MSG(RxStatic)
afx_msg void OnPaint();
}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
CFont m_font;
COLORREF m_TextColor,m_ShadowColor;
};
{{AFX_INSERT_LOCATION}}
Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif !defined(AFX_RXSTATIC_H__70E9FD6D_E341_41D9_B347_A09A3AA868C3__INCLUDED_)

C++ Source Part Two
#if !defined(AFX_OFFICER_H__DD010A11_0E5B_4762_B002_A3488892C751__INCLUDED_)
#define AFX_OFFICER_H__DD010A11_0E5B_4762_B002_A3488892C751__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif _MSC_VER > 1000
OFFICER.h : header file
COFFICER dialog
class COFFICER : public CDialog
{
Construction
public:
COFFICER(CWnd pParent = NULL); standard constructor
-----图像数据参数与方法------------
HBITMAP m_hPhotoBitmap;
DWORD m_nFileLen;
HBITMAP BufferToHBITMAP();
BOOL LoadBMPFile(const char pBMPPathname);
char m_pBMPBuffer;
void DestroyPhoto();
void DrawUserPhoto(int x,int y,CDC pDC);
CBrush m_brush_static;label
CBrush m_brush_dlg;dlg
Dialog Data
{{AFX_DATA(COFFICER)
enum { IDD = IDD_OFFICRER_DLG };
CString m_stroffjzlx;
CString m_stroffsex;
CString m_stroffzc;
CString m_stroffzw;
CTime m_timeoffbirth;
CString m_stroffid;
CString m_stroffjiguan;
CString m_stroffjzbh;
CString m_strofflxdz;
CString m_stroffminzu;
CString m_stroffmark;
CString m_stroffname;
CString m_stroffphone;
CString m_stroffpostcode;
CString m_stroffzjh;
CString m_stroffzsdz;
}}AFX_DATA
Overrides
ClassWizard generated virtual function overrides
{{AFX_VIRTUAL(COFFICER)
protected:
virtual void DoDataExchange(CDataExchange pDX); DDXDDV support
}}AFX_VIRTUAL
Implementation
protected:
Generated message map functions
{{AFX_MSG(COFFICER)
afx_msg void OnButtonZyTijiao();
afx_msg void OnButtonJlLoadphoto();
afx_msg void OnPaint();
virtual BOOL OnInitDialog();
afx_msg HBRUSH OnCtlColor(CDC pDC, CWnd pWnd, UINT nCtlColor);
}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
{{AFX_INSERT_LOCATION}}
Microsoft Visual C++ will insert ad

ditional declarations immediately before the previous line.
#endif !defined(AFX_OFFICER_H__DD010A11_0E5B_4762_B002_A3488892C751__INCLUDED_)

C++ Source Part Three
#if !defined(AFX_MYFRAME_H__8223E71A_07B2_40C8_B171_32EDDB543969__INCLUDED_)
#define AFX_MYFRAME_H__8223E71A_07B2_40C8_B171_32EDDB543969__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif _MSC_VER > 1000
MyFrame.h : header file
CMyFrame frame
class CMyFrame : public CFrameWnd
{
DECLARE_DYNCREATE(CMyFrame)
public:
CMyFrame(); protected constructor used by dynamic creation
Attributes
public:
Operations
public:
protected: control bar embedded members
CStatusBar m_wndStatusBar;
CToolBar m_wndToolBar;
CSplitterWnd m_wndSplitter;
Overrides
ClassWizard generated virtual function overrides
{{AFX_VIRTUAL(CMyFrame)
public:
virtual BOOL DestroyWindow();
virtual BOOL PreTranslateMessage(MSG pMsg);
protected:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
}}AFX_VIRTUAL
Implementation
protected:
virtual ~CMyFrame();
Generated message map functions
{{AFX_MSG(CMyFrame)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnDestroy();
}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
{{AFX_INSERT_LOCATION}}
Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif !defined(AFX_MYFRAME_H__8223E71A_07B2_40C8_B171_32EDDB543969__INCLUDED_)

C++ Source Part Four
khmy.cpp : implementation file
#include "stdafx.h"
#include "khmanager.h"
#include "khmy.h"
#include "ado.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
int khmydclnum=0;
int khmydxiugai=0;
khmy dialog
khmy::khmy(CWnd pParent =NULL)
: CDialog(khmy::IDD, pParent)
{
{{AFX_DATA_INIT(khmy)
}}AFX_DATA_INIT
}
void khmy::DoDataExchange(CDataExchange pDX)
{
CDialog::DoDataExchange(pDX);
{{AFX_DATA_MAP(khmy)
DDX_Control(pDX, IDC_EDIT3, m_edit3);
DDX_Control(pDX, IDC_LIST1, m_list);
DDX_Control(pDX, IDC_EDIT2, m_edit2);
DDX_Control(pDX, IDC_EDIT1, m_edit1);
}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(khmy, CDialog)
{{AFX_MSG_MAP(khmy)
ON_COMMAND(ID_ADD, OnAdd)
ON_COMMAND(ID_DELETE, OnDelete)
ON_COMMAND(ID_EXIT, OnExit)
ON_COMMAND(ID_UPDATE, OnUpdate)
ON_COMMAND(ID_UP, OnUp)
ON_COMMAND(ID_SAVE, OnSave)
ON_COMMAND(ID_CANCEL, OnCancel)
ON_NOTIFY(NM_DBLCLK, IDC_LIST1, OnDblclkList1)
}}AFX_MSG_MAP
END_MESSAGE_MAP()
khmy message handlers
BOOL khmy::OnInitDialog()
{
CDialog::OnInitDialog();

imagelist.Create(32,32,ILC_COLOR32|ILC_MASK,0,0);
imagelist.Add(::LoadIcon(::AfxGetResourceHandle(),MAKEINTRESOURCE(IDI_ICON1)));
imagelist.Add(::LoadIcon(::AfxGetResourceHandle(),MAKEINTRESOURCE(IDI_ICON2)));
imagelist.Add(::LoadIcon(::AfxGetResourceHandle(),MAKEINTRESOURCE(IDI_ICON3)));
imagelist.Add(::LoadIcon(::AfxGetResourceHandle(),MAKEINTRESOURCE(IDI_ICON4)));
imagelist.Add(::LoadIcon(::AfxGetResourceHandle()

,MAKEINTRESOURCE(IDI_ICON5)));
imagelist.Add(::LoadIcon(::AfxGetResourceHandle(),MAKEINTRESOURCE(IDI_ICON10)));

CString s;
TCHAR pString;
menu.LoadMenu(IDR_lxrxx);
toolbar.EnableAutomation();
toolbar.Create(WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,ID_TOOLBAR);
toolbar.SetImageList(&imagelist);
int i;
for(i=0;i<8;i++)
{
button[i].dwData=0;
button[i].fsState=TBSTATE_ENABLED;
button[i].fsStyle=TBSTYLE_BUTTON;
}
button[5].fsStyle=TBSTYLE_SEP;
button[0].idCommand=ID_ADD;
button[0].iBitmap=0;
button[1].idCommand=ID_UPDATE;
button[1].iBitmap=1;
button[2].idCommand=ID_DELETE;
button[2].iBitmap=2;
button[3].idCommand=ID_SAVE;
button[3].iBitmap=3;
button[4].idCommand=ID_CANCEL;
button[4].iBitmap=4;
button[6].idCommand=ID_EXIT;
button[6].iBitmap=5;
for(i=0;i<8;i++)
{
s.LoadString(i+IDS_21);
int nStringLength= s.GetLength() + 1;
pString = s.GetBufferSetLength(nStringLength);

button[i].iString =toolbar.AddStrings(pString);
s.ReleaseBuffer();
}
toolbar.AddButtons(7,button);
toolbar.AutoSize();
toolbar.SetStyle(TBSTYLE_FLAT|CCS_TOP);
toolbar.EnableButton(ID_SAVE,false);
toolbar.EnableButton(ID_CANCEL,false);
m_list.ModifyStyle(0L,LVS_REPORT);
m_list.ModifyStyle(0L,LVS_SINGLESEL);
m_list.ModifyStyle(0L,LVS_SHOWSELALWAYS);
m_list.ModifyStyle(0L,LVS_NOSORTHEADER);
m_list.SetExtendedStyle(LVS_EX_GRIDLINES|
LVS_EX_FULLROWSELECT|
LVS_EX_HEADERDRAGDROP|
LVS_EX_ONECLICKACTIVATE);
m_list.InsertColumn(0,"客户满意度编号");
m_list.InsertColumn(1,"客户满意度名称");
m_list.InsertColumn(2,"备注信息");

m_list.SetColumnWidth(0,100);
m_list.SetColumnWidth(1,100);
m_list.SetColumnWidth(2,100);

this->loadlist();
this->enbalewin(false);
this->datatotext();
this->texttowin();

return TRUE; return TRUE unless you set the focus to a control
EXCEPTION: OCX Property Pages should return FALSE
}
void khmy::OnAdd()
{
this->enbalewin(true);
this->enablebutton(false);
this->clearall();
this->autonum();

}
void khmy::OnCancel()
{
this->enbalewin(false);
this->enablebutton(true);
khmydxiugai=0;
this->datatotext();
this->texttowin();

}
void khmy::OnDelete()
{
ado rst;
CString ss,aa;
this->m_edit1.GetWindowText(aa);
if(aa.IsEmpty())
{MessageBox("不能为空","提示");
return;}
if(MessageBox("删除后数据将丢失","提示",MB_YESNO)==IDYES)
{
ss.Format("delete from tb_Client_khmyd where khmyd_id = '%s'",aa);
rst.ExecuteSQL(ss);
m_list.DeleteAllItems();
this->loadlist();
this->datatotext();
this->texttowin();
}

}
void khmy::OnExit()
{
this->EndDialog(true);

}
void khmy::OnUpdate()
{
CString ss,aa;
this->m_edit1.GetWindowText(aa);
if(aa.IsEmpty())
{MessageBox("不能为空","提示");
return;}
this->enbalewin(true);
this->enablebutton(false);
khmydxiugai=1;

}
void khmy::OnSave()
{
ado rst;
this->wintotext();
CString ss,sre

pt;
srept.Format("select from tb_Client_khmyd where khmyd_myd='%s'",edit2);
rst.rstOpen(srept);
if(rst.GetRecordCount()>0)
{
MessageBox("这个满意度名称已经存在了","提示");
return;
}
if(khmydxiugai==1)
{ss.Format("UPDATE tb_Client_khmyd set khmyd_myd='%s',khmyd_bz='%s' where khmyd_id='%s'",edit2,edit3,edit1);}
else
{ss.Format("INSERT INTO tb_Client_khmyd values('%s','%s','%s')",edit1,edit2,edit3);}
rst.ExecuteSQL(ss);
m_list.DeleteAllItems();
this->loadlist();
this->datatotext();
this->texttowin();
this->enbalewin(false);
this->enablebutton(true);
khmydxiugai=0;
}
void khmy::OnUp()
{
TODO: Add your command handler code here

}
void khmy::clearall()
{
this->m_edit1.SetWindowText("");
this->m_edit2.SetWindowText("");
this->m_edit3.SetWindowText("");
}
void khmy::enablebutton(bool butn)
{
toolbar.EnableButton(ID_ADD,butn);
toolbar.EnableButton(ID_UPDATE,butn);
toolbar.EnableButton(ID_DELETE,butn);
toolbar.EnableButton(ID_SAVE,!butn);
toolbar.EnableButton(ID_CANCEL,!butn);
}
void khmy::enbalewin(bool wi)
{
this->m_edit1.EnableWindow(wi);
this->m_edit2.EnableWindow(wi);
this->m_edit3.EnableWindow(wi);
}
void khmy::texttowin()
{
this->m_edit1.SetWindowText(edit1);
this->m_edit2.SetWindowText(edit2);
this->m_edit3.SetWindowText(edit3);
}
void khmy::wintotext()
{
this->m_edit1.GetWindowText(edit1);
this->m_edit2.GetWindowText(edit2);
this->m_edit3.GetWindowText(edit3);
}
void khmy::datatotext()
{
edit1=m_list.GetItemText(khmydclnum,0);
edit2=m_list.GetItemText(khmydclnum,1);
edit3=m_list.GetItemText(khmydclnum,2);
}
void khmy::loadlist()
{
ado rst;
rst.rstOpen("select from tb_Client_khmyd");
int recordcount=rst.GetRecordCount();
int ii;
for(ii=1;ii<=recordcount;ii++)
{
m_list.InsertItem(ii-1,"");
m_list.SetItemText(ii-1,0,rst.GetFieldValue("khmyd_id"));
m_list.SetItemText(ii-1,1,rst.GetFieldValue("khmyd_myd"));
m_list.SetItemText(ii-1,2,rst.GetFieldValue("khmyd_bz"));
rst.Move(ii);
}
rst.close();
}
void khmy::autonum()
{
ado rst3;
rst3.rstOpen("select from tb_Client_khmyd");
if(rst3.GetRecordCount()==0)
{
this->m_edit1.SetWindowText("KMYD001");
this->m_edit1.EnableWindow(false);
return;
}

rst3.MoveLast();
CString mm=rst3.GetFieldValue("khmyd_id");
int xuhao=atoi(mm.Right(3));
xuhao+=1;
mm.Format("KMYD%03d",xuhao);
this->m_edit1.EnableWindow(false);

this->m_edit1.SetWindowText(mm);
rst3.close();
}
void khmy::OnDblclkList1(NMHDR pNMHDR, LRESULT pResult)
{
khmydclnum=m_list.GetHotItem();
if(khmydclnum<0)
{return;}
this->datatotext();
this->texttowin();
this->enbalewin(false);
this->enablebutton(true);

pResult = 0;
}
BOOL khmy::PreTranslateMessage(MSG pMsg)
{
TODO: Add your specialized code here andor call the base class
if(pMsg->message==WM_KEYDOWN && pMsg->wParam==13)
pMsg->wParam=9;
return CDialog::PreTranslateMessage(pMsg);
}

C++ So

urce Part Five
#if !defined(AFX_VCTITLE_H__E6D979EA_1ED4_46E2_AE78_83FA81D4A520__INCLUDED_)
#define AFX_VCTITLE_H__E6D979EA_1ED4_46E2_AE78_83FA81D4A520__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif _MSC_VER > 1000
Machine generated IDispatch wrapper class(es) created by Microsoft Visual C++
NOTE: Do not modify the contents of this file. If this class is regenerated by
Microsoft Visual C++, your modifications will be overwritten.
Dispatch interfaces referenced by this interface
class CVcTextLayout;
class CVcLocation;
class CVcBackdrop;
class CVcFont;
class COleFont;
CVcTitle wrapper class
class CVcTitle : public COleDispatchDriver
{
public:
CVcTitle() {} Calls COleDispatchDriver default constructor
CVcTitle(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
CVcTitle(const CVcTitle& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
Attributes
public:
Operations
public:
CVcTextLayout GetTextLayout();
CString GetText();
void SetText(LPCTSTR lpszNewValue);
CVcLocation GetLocation();
CVcBackdrop GetBackdrop();
CVcFont GetVtFont();
short GetTextLength();
void SetRefFont(LPDISPATCH newValue);
COleFont GetFont();
void Select();
};
{{AFX_INSERT_LOCATION}}
Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif !defined(AFX_VCTITLE_H__E6D979EA_1ED4_46E2_AE78_83FA81D4A520__INCLUDED_)


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