Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

104 lines
2.6 KiB

  1. // DhcpEximDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "DhcpEximx.h"
  5. #include "DhcpEximDlg.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // CDhcpEximDlg dialog
  13. CDhcpEximDlg::CDhcpEximDlg(CWnd* pParent /*=NULL*/)
  14. : CDialog(CDhcpEximDlg::IDD, pParent)
  15. {
  16. //{{AFX_DATA_INIT(CDhcpEximDlg)
  17. //}}AFX_DATA_INIT
  18. // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
  19. m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
  20. }
  21. void CDhcpEximDlg::DoDataExchange(CDataExchange* pDX)
  22. {
  23. CDialog::DoDataExchange(pDX);
  24. //{{AFX_DATA_MAP(CDhcpEximDlg)
  25. DDX_Control(pDX, IDC_RADIO_EXPORT, m_ExportButton);
  26. //}}AFX_DATA_MAP
  27. }
  28. BEGIN_MESSAGE_MAP(CDhcpEximDlg, CDialog)
  29. //{{AFX_MSG_MAP(CDhcpEximDlg)
  30. ON_WM_PAINT()
  31. ON_WM_QUERYDRAGICON()
  32. //}}AFX_MSG_MAP
  33. END_MESSAGE_MAP()
  34. /////////////////////////////////////////////////////////////////////////////
  35. // CDhcpEximDlg message handlers
  36. BOOL CDhcpEximDlg::OnInitDialog()
  37. {
  38. CDialog::OnInitDialog();
  39. // Set the icon for this dialog. The framework does this automatically
  40. // when the application's main window is not a dialog
  41. SetIcon(m_hIcon, TRUE); // Set big icon
  42. SetIcon(m_hIcon, FALSE); // Set small icon
  43. // TODO: Add extra initialization here
  44. m_ExportButton.SetCheck(1); // Set default as export
  45. return TRUE; // return TRUE unless you set the focus to a control
  46. }
  47. // If you add a minimize button to your dialog, you will need the code below
  48. // to draw the icon. For MFC applications using the document/view model,
  49. // this is automatically done for you by the framework.
  50. void CDhcpEximDlg::OnPaint()
  51. {
  52. if (IsIconic())
  53. {
  54. CPaintDC dc(this); // device context for painting
  55. SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
  56. // Center icon in client rectangle
  57. int cxIcon = GetSystemMetrics(SM_CXICON);
  58. int cyIcon = GetSystemMetrics(SM_CYICON);
  59. CRect rect;
  60. GetClientRect(&rect);
  61. int x = (rect.Width() - cxIcon + 1) / 2;
  62. int y = (rect.Height() - cyIcon + 1) / 2;
  63. // Draw the icon
  64. dc.DrawIcon(x, y, m_hIcon);
  65. }
  66. else
  67. {
  68. CDialog::OnPaint();
  69. }
  70. }
  71. // The system calls this to obtain the cursor to display while the user drags
  72. // the minimized window.
  73. HCURSOR CDhcpEximDlg::OnQueryDragIcon()
  74. {
  75. return (HCURSOR) m_hIcon;
  76. }
  77. void CDhcpEximDlg::OnOK()
  78. {
  79. // TODO: Add extra validation here
  80. // Check whether export or import was chosen by user
  81. m_fExport = ( m_ExportButton.GetCheck() == 1 ) ;
  82. CDialog::OnOK();
  83. }