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.

93 lines
2.4 KiB

  1. // moninfDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "moninf.h"
  5. #include "moninfDlg.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // CMoninfDlg dialog
  13. CMoninfDlg::CMoninfDlg(CWnd* pParent /*=NULL*/)
  14. : CDialog(CMoninfDlg::IDD, pParent)
  15. {
  16. //{{AFX_DATA_INIT(CMoninfDlg)
  17. // NOTE: the ClassWizard will add member initialization here
  18. //}}AFX_DATA_INIT
  19. // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
  20. m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
  21. }
  22. void CMoninfDlg::DoDataExchange(CDataExchange* pDX)
  23. {
  24. CDialog::DoDataExchange(pDX);
  25. //{{AFX_DATA_MAP(CMoninfDlg)
  26. // NOTE: the ClassWizard will add DDX and DDV calls here
  27. //}}AFX_DATA_MAP
  28. }
  29. BEGIN_MESSAGE_MAP(CMoninfDlg, CDialog)
  30. //{{AFX_MSG_MAP(CMoninfDlg)
  31. ON_WM_PAINT()
  32. ON_WM_QUERYDRAGICON()
  33. //}}AFX_MSG_MAP
  34. END_MESSAGE_MAP()
  35. /////////////////////////////////////////////////////////////////////////////
  36. // CMoninfDlg message handlers
  37. BOOL CMoninfDlg::OnInitDialog()
  38. {
  39. CDialog::OnInitDialog();
  40. // Set the icon for this dialog. The framework does this automatically
  41. // when the application's main window is not a dialog
  42. SetIcon(m_hIcon, TRUE); // Set big icon
  43. SetIcon(m_hIcon, FALSE); // Set small icon
  44. // TODO: Add extra initialization here
  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 CMoninfDlg::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 CMoninfDlg::OnQueryDragIcon()
  74. {
  75. return (HCURSOR) m_hIcon;
  76. }