Source code of Windows XP (NT5)
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.

89 lines
2.1 KiB

  1. //Copyright (c) 1998 - 1999 Microsoft Corporation
  2. // installrDlg.cpp : implementation file
  3. //
  4. #include "stdafx.h"
  5. #include "installr.h"
  6. #include "installrDlg.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. /////////////////////////////////////////////////////////////////////////////
  13. // CInstallrDlg dialog
  14. CInstallrDlg::CInstallrDlg(CWnd* pParent /*=NULL*/)
  15. : CDialog(CInstallrDlg::IDD, pParent)
  16. {
  17. //{{AFX_DATA_INIT(CInstallrDlg)
  18. // NOTE: the ClassWizard will add member initialization here
  19. //}}AFX_DATA_INIT
  20. m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
  21. }
  22. void CInstallrDlg::DoDataExchange(CDataExchange* pDX)
  23. {
  24. CDialog::DoDataExchange(pDX);
  25. //{{AFX_DATA_MAP(CInstallrDlg)
  26. // NOTE: the ClassWizard will add DDX and DDV calls here
  27. //}}AFX_DATA_MAP
  28. }
  29. BEGIN_MESSAGE_MAP(CInstallrDlg, CDialog)
  30. //{{AFX_MSG_MAP(CInstallrDlg)
  31. ON_WM_PAINT()
  32. ON_WM_QUERYDRAGICON()
  33. //}}AFX_MSG_MAP
  34. END_MESSAGE_MAP()
  35. /////////////////////////////////////////////////////////////////////////////
  36. // CInstallrDlg message handlers
  37. BOOL CInstallrDlg::OnInitDialog()
  38. {
  39. CDialog::OnInitDialog();
  40. SetIcon(m_hIcon, TRUE); // Set big icon
  41. SetIcon(m_hIcon, FALSE); // Set small icon
  42. // TODO: Add extra initialization here
  43. return TRUE; // return TRUE unless you set the focus to a control
  44. }
  45. // If you add a minimize button to your dialog, you will need the code below
  46. // to draw the icon. For MFC applications using the document/view model,
  47. // this is automatically done for you by the framework.
  48. void CInstallrDlg::OnPaint()
  49. {
  50. if (IsIconic())
  51. {
  52. CPaintDC dc(this); // device context for painting
  53. SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
  54. // Center icon in client rectangle
  55. int cxIcon = GetSystemMetrics(SM_CXICON);
  56. int cyIcon = GetSystemMetrics(SM_CYICON);
  57. CRect rect;
  58. GetClientRect(&rect);
  59. int x = (rect.Width() - cxIcon + 1) / 2;
  60. int y = (rect.Height() - cyIcon + 1) / 2;
  61. // Draw the icon
  62. dc.DrawIcon(x, y, m_hIcon);
  63. }
  64. else
  65. {
  66. CDialog::OnPaint();
  67. }
  68. }
  69. HCURSOR CInstallrDlg::OnQueryDragIcon()
  70. {
  71. return (HCURSOR) m_hIcon;
  72. }