Serial Debugging assistant source code Analysis, Sub-dialog box section

Source: Internet
Author: User

Noon Analysis of the blog of the Sub-dialog box program:

//Management.cpp:implementation File//#include"stdafx.h"#include"doorcontrol.h"#include"Management.h"#ifdef _DEBUG#defineNew Debug_new#undefThis_fileStatic CharThis_file[] =__file__;#endif///////////////////////////////////////////////////////////////////////////////Cmanagement Dialogcmanagement::cmanagement (CWnd* pparent/*=null*/): CDialog (Cmanagement::idd, pparent) {//{{afx_data_init (cmanagement)//}}afx_data_init}voidCmanagement::D Odataexchange (cdataexchange*PDX)    {CDialog::D odataexchange (PDX); //{{Afx_data_map (cmanagement)//DDX_Control (PDX, Idc_bun_delet, m_btn_delet);DDX_Control (PDX, Idc_list, m_list); //}}afx_data_map}begin_message_map (cmanagement, CDialog)//{{Afx_msg_map (cmanagement)on_bn_clicked (Idc_butn_add, Onbutnadd) on_bn_clicked (idc_butn_modify, onbutnmodify) on_bn_clicked (IDC_BUN_DE Let, Onbundelet) on_bn_clicked (Idc_butn_search, Onbutnsearch) on_bn_clicked (Idc_butn_save, OnButnSave) ON_BN_CLIC KED (Idc_butn_close, Onbutnclose)//}}afx_msg_mapEnd_message_map ()///////////////////////////////////////////////////////////////////////////////cmanagement message handlersBOOL Cmanagement::oninitdialog () {cdialog::oninitdialog (); //Todo:add Extra Initialization hereM_list. SetExtendedStyle (Lvs_ex_fullrowselect |lvs_ex_gridlines); M_list. SetBkColor (RGB (247,247,255)); M_list. SetTextColor (RGB (0,0,255)); M_list. Settextbkcolor (RGB (247,247,255)); M_list. InsertColumn (0,"Card number", Lvcfmt_left, -); M_list. InsertColumn (1,"name", Lvcfmt_left, -); M_list. InsertColumn (2,"Permissions", Lvcfmt_left, the); M_list. InsertColumn (3,"Last use time", Lvcfmt_left, $); M_list. InsertItem (0,"15870295"); M_list. Setitemtext (0,1,"Xiao Chen"); M_list. Setitemtext (0,2,"1,2,3,4,5"); M_list. Setitemtext (0,3,"2011,4,20 23:22:11"); M_list. InsertItem (1,"02112126"); M_list. Setitemtext (1,1,"Xiao Theory"); M_list. Setitemtext (1,2,"5,6,7"); M_list. Setitemtext (1,3,"2011,4,21 13:02:18"); M_list. InsertItem (2,"18112125"); M_list. Setitemtext (2,1,"on Chen Hong"); M_list. Setitemtext (2,2,"5,9"); M_list. Setitemtext (2,3,"2011,4,21 21:22:00"); M_list. InsertItem (3,"20888103"); M_list. Setitemtext (3,1,"Google"); M_list. Setitemtext (3,2,"1,2,9"); M_list. Setitemtext (3,3,"2010,4,20 02:24:41"); M_btn_add. SubclassDlgItem (Idc_butn_add, This); M_btn_add.    SetIcon (Idi_icon_add); M_btn_add. SetColor (Cbuttonst::btnst_color_bk_out, RGB (208,208,208)); M_btn_add. SetColor (Cbuttonst::btnst_color_bk_focus, RGB (208,208,208)); M_btn_add. Offsetcolor (cbuttonst::btnst_color_bk_in, -); M_btn_close. SubclassDlgItem (Idc_butn_close, This); M_btn_close.    SetIcon (Idi_icon_close); M_btn_close. SetColor (Cbuttonst::btnst_color_bk_out, RGB (208,208,208)); M_btn_close. SetColor (Cbuttonst::btnst_color_bk_focus, RGB (208,208,208)); M_btn_close. Offsetcolor (cbuttonst::btnst_color_bk_in, -); M_btn_modify. SubclassDlgItem (Idc_butn_modify, This); M_btn_modify.    SetIcon (idi_icon_modify); M_btn_modify. SetColor (Cbuttonst::btnst_color_bk_out, RGB (208,208,208)); M_btn_modify. SetColor (Cbuttonst::btnst_color_bk_focus, RGB (208,208,208)); M_btn_modify. Offsetcolor (cbuttonst::btnst_color_bk_in, -); M_btn_delet. SubclassDlgItem (Idc_bun_delet, This); M_btn_delet.    SetIcon (Idi_icon_delet); M_btn_delet. SetColor (Cbuttonst::btnst_color_bk_out, RGB (208,208,208)); M_btn_delet. SetColor (Cbuttonst::btnst_color_bk_focus, RGB (208,208,208)); M_btn_delet. Offsetcolor (cbuttonst::btnst_color_bk_in, -); M_btn_save. SubclassDlgItem (Idc_butn_save, This); M_btn_save.    SetIcon (Idi_icon_save); M_btn_save. SetColor (Cbuttonst::btnst_color_bk_out, RGB (208,208,208)); M_btn_save. SetColor (Cbuttonst::btnst_color_bk_focus, RGB (208,208,208)); M_btn_save. Offsetcolor (cbuttonst::btnst_color_bk_in, -); M_btn_search. SubclassDlgItem (Idc_butn_search, This); M_btn_search.    SetIcon (Idi_icon_search); M_btn_search. SetColor (Cbuttonst::btnst_color_bk_out, RGB (208,208,208)); M_btn_search. SetColor (Cbuttonst::btnst_color_bk_focus, RGB (208,208,208)); M_btn_search. Offsetcolor (cbuttonst::btnst_color_bk_in, -); returnTRUE;//return TRUE Unless you set the focus to a control//Exception:ocx Property Pages should return FALSE}voidCmanagement::onbutnadd () {//Todo:add your control notification handler code here    }voidcmanagement::onbutnmodify () {//Todo:add your control notification handler code here    }//Delete ItemvoidCmanagement::onbundelet () {//Todo:add your control notification handler code herePOSITION pos =m_list.    Getfirstselecteditemposition (); M_nindex= M_list. Getnextselecteditem (POS);//Get Project Index        if(m_nindex==-1) {MessageBox ("Please select an item in the delete!","Tips", mb_iconinformation); return; } m_list.         DeleteItem (M_nindex); UINT Flag= lvis_selected|lvis_focused; M_list. SetItemState (M_nindex-1, flag, flag);}voidCmanagement::onbutnsearch () {//Todo:add your control notification handler code here    }//Save DatavoidCmanagement::onbutnsave () {//Todo:add your control notification handler code hereCStdioFile SF; if(SF. Open ("personnel information. txt", Cfile::modecreate |cfile::modewrite))        {CString strout; Strout="\ r \ n Card number \t\t name \t\t permissions \t\t recent usage \ r \ n"; sf.                WriteString (Strout);  for(intI=0; i<m_list. GetItemCount (); i++) {Strout=m_list. GetItemText (I,0) +"\ t"+m_list. GetItemText (I,1)+"\ t"+m_list. GetItemText (I,2) +"\ t"+m_list. GetItemText (I,3)+"\ r \ n"; sf.        WriteString (Strout); } SF.        Close (); MessageBox ("Save success!","Tips", mb_iconinformation); }        ElseMessageBox ("Save failed!","Tips", mb_iconinformation);}voidCmanagement::onbutnclose () {//Todo:add your control notification handler code here    }

Serial Debugging assistant source code Analysis, Sub-dialog box section

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.