//LCBoxDlg. CPP: implementation file
//
# include "stdafx. H"
# include "LCBox. H"
# include "LCBoxDlg. H"
# ifdef _DEBUG
# define new DEBUG_NEW
# undef THIS_FILE
The static char THIS_FILE []=__FILE__;
# endif
/////////////////////////////////////////////////////////////////////////////
//CAboutDlg dialog informs the for App About
The class CAboutDlg: public CDialog
{
Public:
CAboutDlg ();
//Dialog Data
//{{AFX_DATA (CAboutDlg)
Enum {IDD=IDD_ABOUTBOX};
//}} AFX_DATA
//ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL (CAboutDlg)
Protected:
Virtual void DoDataExchange (CDataExchange * symbol;//(DDX/DDV support
//}} AFX_VIRTUAL
//Implementation
Protected:
//{{AFX_MSG (CAboutDlg)
//}} AFX_MSG
DECLARE_MESSAGE_MAP ()
};
CAboutDlg: : CAboutDlg () : CDialog CAboutDlg: : (IDD)
{
//{{AFX_DATA_INIT (CAboutDlg)
//}} AFX_DATA_INIT
}
Void CAboutDlg: : DoDataExchange (CDataExchange * symbol)
{
CDialog: : DoDataExchange (symbol);
//{{AFX_DATA_MAP (CAboutDlg)
//}} AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP (CAboutDlg CDialog)
//{{AFX_MSG_MAP (CAboutDlg)
//No message handlers
//}} AFX_MSG_MAP
END_MESSAGE_MAP ()
/////////////////////////////////////////////////////////////////////////////
//CLCBoxDlg dialog
CLCBoxDlg: : CLCBoxDlg (pParent/*=NULL CWnd * */)
: CDialog (CLCBoxDlg: : IDD, pParent)
{
//{{AFX_DATA_INIT (CLCBoxDlg)
//NOTE: the ClassWizard will add member initialization here
//}} AFX_DATA_INIT
//Note that LoadIcon does not require a subsequent DestroyIcon in Win32
M_hIcon=AfxGetApp () - & gt; LoadIcon (IDR_MAINFRAME);
}
Void CLCBoxDlg: : DoDataExchange (CDataExchange * symbol)
{
CDialog: : DoDataExchange (symbol);
//{{AFX_DATA_MAP (CLCBoxDlg)
//NOTE: the ClassWizard will add DDX and DDV calls here
//}} AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP (CLCBoxDlg CDialog)
//{{AFX_MSG_MAP (CLCBoxDlg)
ON_WM_SYSCOMMAND ()
ON_WM_PAINT ()
ON_WM_QUERYDRAGICON ()
ON_BN_CLICKED (IDC_ADD, OnAdd)
ON_BN_CLICKED (IDC_DELETE OnDelete)
ON_NOTIFY (NM_CLICK IDC_LIST, OnClickList)
//}} AFX_MSG_MAP
END_MESSAGE_MAP ()
/////////////////////////////////////////////////////////////////////////////
//CLCBoxDlg message handlers
BOOL CLCBoxDlg: : OnInitDialog ()
{
CDialog: : OnInitDialog ();
//Add "About... "Menu item to system menu.
//IDM_ABOUTBOX must be in the system command range.
ASSERT ((IDM_ABOUTBOX & amp; 0==IDM_ABOUTBOX xfff0));
ASSERT (IDM_ABOUTBOX & lt; 0 xf000);
CMenu * pSysMenu=GetSystemMenu (FALSE);
If (pSysMenu!=NULL)
{
Cstrings strAboutMenu;
StrAboutMenu. LoadString (IDS_ABOUTBOX);
if (! StrAboutMenu. IsEmpty ())
{
PSysMenu - & gt; The AppendMenu (MF_SEPARATOR);
PSysMenu - & gt; AppendMenu (MF_STRING IDM_ABOUTBOX, strAboutMenu);
}
}
//Set the icon for this dialog. The framework does this automatically
//when the application 's main window is not a dialog
SetIcon (m_hIcon, TRUE);//Set the big icon
SetIcon (m_hIcon, FALSE);//Set the small icon
//TODO: Add extra initialization here
return TRUE;//return TRUE unless you set the focus to a control
}
Void CLCBoxDlg: : OnSysCommand (UINT nID, LPARAM LPARAM)
{
If ((nID & amp; 0 xfff0)==IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
DlgAbout. DoModal ();
}
The else
{
CDialog: : OnSysCommand (nID, lParam);
}
}
//If you add a minimize button to your dialog, you will need the code below
//to draw the icon. The For MFC applications using the document/view model,
//this is automatically done for you by the framework.
Void CLCBoxDlg: : OnPaint ()
{
If (IsIconic ())
{
CPaintDC dc (this);//device context for painting
SendMessage (WM_ICONERASEBKGND, (WPARAM) dc. GetSafeHdc (), 0).
//Center icon in the client rectangle
Int cxIcon=GetSystemMetrics (SM_CXICON);
Int cyIcon=GetSystemMetrics (SM_CYICON);
CRect the rect.
GetClientRect (& amp; The rect);
Int x=(the rect. Width () - cxIcon + 1)/2;
Int y=(the rect. Height () - cyIcon + 1)/2;
//Draw the icon
Dc. DrawIcon (x, y, m_hIcon);
}
The else
{
CDialog: : OnPaint ();
}
}
//The system calls this to obtain The cursor to display while The user drags
//the minimized window.
HCURSOR CLCBoxDlg: : OnQueryDragIcon ()
{
Return (HCURSOR) m_hIcon;
}
Void CLCBoxDlg: : OnAdd ()
{
//TODO: Add your the control notification handler code here
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull