myadvDlg.cpp
Upload User: fhtm20
Upload Date: 2021-02-11
Package Size: 3405k
Code Size: 5k
Development Platform:

Visual C++

  1. // myadvDlg.cpp : implementation file
  2. // 说明: 功能函数类
  3. // 作者:依星(airen3339@163.com)
  4. // 日期:2005.12
  5. //////////////////////////////////////////////////////////////////////
  6. // Download by http://www.codefans.net
  7. #include "stdafx.h"
  8. #include "myadv.h"
  9. #include "myadvDlg.h"
  10. #ifdef _DEBUG
  11. #define new DEBUG_NEW
  12. #undef THIS_FILE
  13. static char THIS_FILE[] = __FILE__;
  14. #endif
  15. /////////////////////////////////////////////////////////////////////////////
  16. // CAboutDlg dialog used for App About
  17. class CAboutDlg : public CDialog
  18. {
  19. public:
  20. CAboutDlg();
  21. // Dialog Data
  22. //{{AFX_DATA(CAboutDlg)
  23. enum { IDD = IDD_ABOUTBOX };
  24. //}}AFX_DATA
  25. // ClassWizard generated virtual function overrides
  26. //{{AFX_VIRTUAL(CAboutDlg)
  27. protected:
  28. virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  29. //}}AFX_VIRTUAL
  30. // Implementation
  31. protected:
  32. //{{AFX_MSG(CAboutDlg)
  33. //}}AFX_MSG
  34. DECLARE_MESSAGE_MAP()
  35. };
  36. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  37. {
  38. //{{AFX_DATA_INIT(CAboutDlg)
  39. //}}AFX_DATA_INIT
  40. }
  41. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  42. {
  43. CDialog::DoDataExchange(pDX);
  44. //{{AFX_DATA_MAP(CAboutDlg)
  45. //}}AFX_DATA_MAP
  46. }
  47. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  48. //{{AFX_MSG_MAP(CAboutDlg)
  49. // No message handlers
  50. //}}AFX_MSG_MAP
  51. END_MESSAGE_MAP()
  52. /////////////////////////////////////////////////////////////////////////////
  53. // CMyadvDlg dialog
  54. CMyadvDlg::CMyadvDlg(CWnd* pParent /*=NULL*/)
  55. : CDialog(CMyadvDlg::IDD, pParent)
  56. {
  57. //{{AFX_DATA_INIT(CMyadvDlg)
  58. // NOTE: the ClassWizard will add member initialization here
  59. //}}AFX_DATA_INIT
  60. // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
  61. m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
  62. }
  63. void CMyadvDlg::DoDataExchange(CDataExchange* pDX)
  64. {
  65. CDialog::DoDataExchange(pDX);
  66. //{{AFX_DATA_MAP(CMyadvDlg)
  67. // NOTE: the ClassWizard will add DDX and DDV calls here
  68. //}}AFX_DATA_MAP
  69. }
  70. BEGIN_MESSAGE_MAP(CMyadvDlg, CDialog)
  71. //{{AFX_MSG_MAP(CMyadvDlg)
  72. ON_WM_SYSCOMMAND()
  73. ON_WM_PAINT()
  74. ON_WM_QUERYDRAGICON()
  75. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  76. ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
  77. //}}AFX_MSG_MAP
  78. END_MESSAGE_MAP()
  79. /////////////////////////////////////////////////////////////////////////////
  80. // CMyadvDlg message handlers
  81. BOOL CMyadvDlg::OnInitDialog()
  82. {
  83. CDialog::OnInitDialog();
  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. if (pSysMenu != NULL)
  90. {
  91. CString strAboutMenu;
  92. strAboutMenu.LoadString(IDS_ABOUTBOX);
  93. if (!strAboutMenu.IsEmpty())
  94. {
  95. pSysMenu->AppendMenu(MF_SEPARATOR);
  96. pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
  97. }
  98. }
  99. // Set the icon for this dialog.  The framework does this automatically
  100. //  when the application's main window is not a dialog
  101. SetIcon(m_hIcon, TRUE); // Set big icon
  102. SetIcon(m_hIcon, FALSE); // Set small icon
  103. // TODO: Add extra initialization here
  104. m_WebPage1.CreateFromStatic(IDC_END_ADV, this);
  105. m_WebPage1.LoadFromResource(_T("adv01.htm"));
  106. return TRUE;  // return TRUE  unless you set the focus to a control
  107. }
  108. void CMyadvDlg::OnSysCommand(UINT nID, LPARAM lParam)
  109. {
  110. if ((nID & 0xFFF0) == IDM_ABOUTBOX)
  111. {
  112. CAboutDlg dlgAbout;
  113. dlgAbout.DoModal();
  114. }
  115. else
  116. {
  117. CDialog::OnSysCommand(nID, lParam);
  118. }
  119. }
  120. // If you add a minimize button to your dialog, you will need the code below
  121. //  to draw the icon.  For MFC applications using the document/view model,
  122. //  this is automatically done for you by the framework.
  123. void CMyadvDlg::OnPaint() 
  124. {
  125. if (IsIconic())
  126. {
  127. CPaintDC dc(this); // device context for painting
  128. SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
  129. // Center icon in client rectangle
  130. int cxIcon = GetSystemMetrics(SM_CXICON);
  131. int cyIcon = GetSystemMetrics(SM_CYICON);
  132. CRect rect;
  133. GetClientRect(&rect);
  134. int x = (rect.Width() - cxIcon + 1) / 2;
  135. int y = (rect.Height() - cyIcon + 1) / 2;
  136. // Draw the icon
  137. dc.DrawIcon(x, y, m_hIcon);
  138. }
  139. else
  140. {
  141. CDialog::OnPaint();
  142. }
  143. }
  144. // The system calls this to obtain the cursor to display while the user drags
  145. //  the minimized window.
  146. HCURSOR CMyadvDlg::OnQueryDragIcon()
  147. {
  148. return (HCURSOR) m_hIcon;
  149. }
  150. void CMyadvDlg::OnButton1() 
  151. {
  152. // TODO: Add your control notification handler code here
  153. pMyFun->ShowHtml(L"http://home.202030.com/wzb175");
  154. }
  155. void CMyadvDlg::OnButton2() 
  156. {
  157. // TODO: Add your control notification handler code here
  158. pMyFun->GetUrl(_T("http://estar.jnhyw.com/"));
  159. }