DlgDeleteFileDBItem.cpp
上传用户:lds876
上传日期:2013-05-25
资源大小:567k
文件大小:3k
源码类别:

P2P编程

开发平台:

Visual C++

  1. // DlgDeleteFileDBItem.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "testbt.h"
  5. #include "DlgDeleteFileDBItem.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. const CString CDlgDeleteFileDBItem::m_strSection = "CDlgDeleteFileDBItem";
  12. /////////////////////////////////////////////////////////////////////////////
  13. // CDlgDeleteFileDBItem dialog
  14. CDlgDeleteFileDBItem::CDlgDeleteFileDBItem(CWnd* pParent /*=NULL*/)
  15. : CDialog(CDlgDeleteFileDBItem::IDD, pParent)
  16. {
  17. //{{AFX_DATA_INIT(CDlgDeleteFileDBItem)
  18. m_bDelUncompleted = FALSE;
  19. m_bDelCompleted = FALSE;
  20. //}}AFX_DATA_INIT
  21. }
  22. void CDlgDeleteFileDBItem::DoDataExchange(CDataExchange* pDX)
  23. {
  24. CDialog::DoDataExchange(pDX);
  25. //{{AFX_DATA_MAP(CDlgDeleteFileDBItem)
  26. DDX_Control(pDX, IDCANCEL, m_btnCancel);
  27. DDX_Control(pDX, IDOK, m_btnOK);
  28. DDX_Check(pDX, IDC_CHECK_DEL_UNCOMPLETED, m_bDelUncompleted);
  29. DDX_Check(pDX, IDC_CHECK_DEL_COMPLETED, m_bDelCompleted);
  30. //}}AFX_DATA_MAP
  31. }
  32. BEGIN_MESSAGE_MAP(CDlgDeleteFileDBItem, CDialog)
  33. //{{AFX_MSG_MAP(CDlgDeleteFileDBItem)
  34. //}}AFX_MSG_MAP
  35. END_MESSAGE_MAP()
  36. /////////////////////////////////////////////////////////////////////////////
  37. // CDlgDeleteFileDBItem message handlers
  38. void CDlgDeleteFileDBItem::LoadState()
  39. {
  40. CString strKey = "uncompleted";
  41. m_bDelUncompleted = AfxGetApp()->GetProfileInt(m_strSection, strKey, m_bDelUncompleted);
  42. strKey = "completed";
  43. m_bDelCompleted = AfxGetApp()->GetProfileInt(m_strSection, strKey, m_bDelCompleted);
  44. }
  45. void CDlgDeleteFileDBItem::SaveState()
  46. {
  47. CString strKey = "uncompleted";
  48. AfxGetApp()->WriteProfileInt(m_strSection, strKey, m_bDelUncompleted);
  49. strKey = "completed";
  50. AfxGetApp()->WriteProfileInt(m_strSection, strKey, m_bDelCompleted);
  51. }
  52. BOOL CDlgDeleteFileDBItem::OnInitDialog() 
  53. {
  54. CDialog::OnInitDialog();
  55. //
  56. // Create BitmapList
  57. //
  58. HBITMAP hbm = (HBITMAP)::LoadImage(AfxGetInstanceHandle(),
  59. MAKEINTRESOURCE(IDB_BITMAP_DLG_ICONS),
  60. IMAGE_BITMAP,
  61. 0,0, // cx,cy
  62. LR_CREATEDIBSECTION); // | LR_LOADMAP3DCOLORS );
  63. CBitmap bm;
  64. bm.Attach(hbm);
  65. m_ctlImage.Create(16,15, ILC_COLOR8|ILC_MASK, 3, 4);
  66. m_ctlImage.SetBkColor(RGB(255, 255,255)); 
  67. m_ctlImage.Add(&bm, (COLORREF)RGB(255,0,255));
  68. //
  69. // set button image.
  70. //
  71. // m_btnBrowseDir.Create(m_ctlImage.ExtractIcon(2), true, "选择保存路径");
  72. m_btnOK.Create(m_ctlImage.ExtractIcon(0));
  73. m_btnCancel.Create(m_ctlImage.ExtractIcon(1));
  74. LoadState();
  75. UpdateData(false);
  76. return TRUE;  // return TRUE unless you set the focus to a control
  77.               // EXCEPTION: OCX Property Pages should return FALSE
  78. }
  79. void CDlgDeleteFileDBItem::OnOK() 
  80. {
  81. UpdateData();
  82. SaveState();
  83. CDialog::OnOK();
  84. }