www.gusucode.com > 一个有创意的VC++屏幕保护源码源码程序 > 一个有创意的VC++屏幕保护源码源码程序\code\MfcSaverDlg.cpp
// MfcSaverDlg.cpp : implementation file // Download by http://www.NewXing.com #include "StdAfx.h" #include "MfcSaver.h" #include "MfcSaverDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// BEGIN_MESSAGE_MAP(CMfcSaverDlg, CB14Dlg) //{{AFX_MSG_MAP(CMfcSaverDlg) ON_WM_PAINT() ON_WM_QUERYDRAGICON() //}}AFX_MSG_MAP END_MESSAGE_MAP() CMfcSaverDlg::CMfcSaverDlg() { //{{AFX_DATA_INIT(CMfcSaverDlg) //}}AFX_DATA_INIT } BOOL CMfcSaverDlg::OnInitDialog() { CB14Dlg::OnInitDialog(); return TRUE; } ///////////////////////////////////////////////////////////////////////////// // // As with most MFC dialog boxes, the DoDataExchange() is where all the work // happens. There's no easy DDX_Trackbar thing to set up the control, so // we do it ourselves. See how the SaveOptions() and RestoreOptions() are // called on the CMfcSaver to keep those options persistent. // void CMfcSaverDlg::DoDataExchange(CDataExchange* pDX) { CB14Dlg::DoDataExchange(pDX); //{{AFX_DATA_MAP(CMfcSaverDlg) //}}AFX_DATA_MAP CMfcSaver* pSaver = (CMfcSaver*)AfxGetScreenSaverWnd(); if (!pSaver) return; CSliderCtrl* pSlider; if (!pDX->m_bSaveAndValidate) { pSaver->RestoreOptions(); pSlider = (CSliderCtrl*)GetDlgItem(IDC_SLIDER1); pSlider->SetRange(1, 50); pSlider->SetPos(pSaver->GetIconCount()); pSlider = (CSliderCtrl*)GetDlgItem(IDC_SLIDER2); pSlider->SetRange(1, 50); pSlider->SetPos(pSaver->GetIconSpeed()); } else { pSlider = (CSliderCtrl*)GetDlgItem(IDC_SLIDER1); pSaver->SetIconCount(pSlider->GetPos()); pSlider = (CSliderCtrl*)GetDlgItem(IDC_SLIDER2); pSaver->SetIconSpeed(pSlider->GetPos()); pSaver->SaveOptions(); } }