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.

171 lines
4.0 KiB

  1. // regtrdlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "regtrace.h"
  5. #include "regtrdlg.h"
  6. #ifdef _DEBUG
  7. #undef THIS_FILE
  8. static char BASED_CODE THIS_FILE[] = __FILE__;
  9. #endif
  10. /////////////////////////////////////////////////////////////////////////////
  11. // CAboutDlg dialog used for App About
  12. class CAboutDlg : public CDialog
  13. {
  14. public:
  15. CAboutDlg();
  16. // Dialog Data
  17. //{{AFX_DATA(CAboutDlg)
  18. enum { IDD = IDD_ABOUTBOX };
  19. //}}AFX_DATA
  20. // Implementation
  21. protected:
  22. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  23. //{{AFX_MSG(CAboutDlg)
  24. virtual BOOL OnInitDialog();
  25. //}}AFX_MSG
  26. DECLARE_MESSAGE_MAP()
  27. };
  28. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  29. {
  30. //{{AFX_DATA_INIT(CAboutDlg)
  31. //}}AFX_DATA_INIT
  32. }
  33. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  34. {
  35. CDialog::DoDataExchange(pDX);
  36. //{{AFX_DATA_MAP(CAboutDlg)
  37. //}}AFX_DATA_MAP
  38. }
  39. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  40. //{{AFX_MSG_MAP(CAboutDlg)
  41. // No message handlers
  42. //}}AFX_MSG_MAP
  43. END_MESSAGE_MAP()
  44. /////////////////////////////////////////////////////////////////////////////
  45. // CAboutDlg message handlers
  46. BOOL CAboutDlg::OnInitDialog()
  47. {
  48. CDialog::OnInitDialog();
  49. CenterWindow();
  50. // TODO: Add extra about dlg initialization here
  51. return TRUE; // return TRUE unless you set the focus to a control
  52. }
  53. /////////////////////////////////////////////////////////////////////////////
  54. // CRegTraceDlg dialog
  55. CRegTraceDlg::CRegTraceDlg(CWnd* pParent /*=NULL*/)
  56. : CDialog(CRegTraceDlg::IDD, pParent)
  57. {
  58. //{{AFX_DATA_INIT(CRegTraceDlg)
  59. // NOTE: the ClassWizard will add member initialization here
  60. //}}AFX_DATA_INIT
  61. // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
  62. m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
  63. }
  64. void CRegTraceDlg::DoDataExchange(CDataExchange* pDX)
  65. {
  66. CDialog::DoDataExchange(pDX);
  67. //{{AFX_DATA_MAP(CRegTraceDlg)
  68. // NOTE: the ClassWizard will add DDX and DDV calls here
  69. //}}AFX_DATA_MAP
  70. }
  71. BEGIN_MESSAGE_MAP(CRegTraceDlg, CDialog)
  72. //{{AFX_MSG_MAP(CRegTraceDlg)
  73. ON_WM_SYSCOMMAND()
  74. ON_WM_PAINT()
  75. ON_WM_QUERYDRAGICON()
  76. //}}AFX_MSG_MAP
  77. END_MESSAGE_MAP()
  78. /////////////////////////////////////////////////////////////////////////////
  79. // CRegTraceDlg message handlers
  80. BOOL CRegTraceDlg::OnInitDialog()
  81. {
  82. CDialog::OnInitDialog();
  83. CenterWindow();
  84. // Add "About..." menu item to system menu.
  85. // IDM_ABOUTBOX must be in the system command range.
  86. ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
  87. ASSERT(IDM_ABOUTBOX < 0xF000);
  88. CMenu* pSysMenu = GetSystemMenu(FALSE);
  89. CString strAboutMenu;
  90. strAboutMenu.LoadString(IDS_ABOUTBOX);
  91. if (!strAboutMenu.IsEmpty())
  92. {
  93. pSysMenu->AppendMenu(MF_SEPARATOR);
  94. pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
  95. }
  96. // TODO: Add extra initialization here
  97. return TRUE; // return TRUE unless you set the focus to a control
  98. }
  99. void CRegTraceDlg::OnSysCommand(UINT nID, LPARAM lParam)
  100. {
  101. if ((nID & 0xFFF0) == IDM_ABOUTBOX)
  102. {
  103. CAboutDlg dlgAbout;
  104. dlgAbout.DoModal();
  105. }
  106. else
  107. {
  108. CDialog::OnSysCommand(nID, lParam);
  109. }
  110. }
  111. // If you add a minimize button to your dialog, you will need the code below
  112. // to draw the icon. For MFC applications using the document/view model,
  113. // this is automatically done for you by the framework.
  114. void CRegTraceDlg::OnPaint()
  115. {
  116. if (IsIconic())
  117. {
  118. CPaintDC dc(this); // device context for painting
  119. SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
  120. // Center icon in client rectangle
  121. int cxIcon = GetSystemMetrics(SM_CXICON);
  122. int cyIcon = GetSystemMetrics(SM_CYICON);
  123. CRect rect;
  124. GetClientRect(&rect);
  125. int x = (rect.Width() - cxIcon + 1) / 2;
  126. int y = (rect.Height() - cyIcon + 1) / 2;
  127. // Draw the icon
  128. dc.DrawIcon(x, y, m_hIcon);
  129. }
  130. else
  131. {
  132. CDialog::OnPaint();
  133. }
  134. }
  135. // The system calls this to obtain the cursor to display while the user drags
  136. // the minimized window.
  137. HCURSOR CRegTraceDlg::OnQueryDragIcon()
  138. {
  139. return (HCURSOR) m_hIcon;
  140. }