PhoneComing.cpp 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. // PhoneComing.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "uphonebox.h"
  5. #include "PhoneComing.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // PhoneComing dialog
  13. PhoneComing::PhoneComing(CWnd* pParent /*=NULL*/)
  14. : CDialog(PhoneComing::IDD, pParent)
  15. {
  16. //{{AFX_DATA_INIT(PhoneComing)
  17. // NOTE: the ClassWizard will add member initialization here
  18. //}}AFX_DATA_INIT
  19. }
  20. void PhoneComing::DoDataExchange(CDataExchange* pDX)
  21. {
  22. CDialog::DoDataExchange(pDX);
  23. //{{AFX_DATA_MAP(PhoneComing)
  24. // NOTE: the ClassWizard will add DDX and DDV calls here
  25. //}}AFX_DATA_MAP
  26. }
  27. BEGIN_MESSAGE_MAP(PhoneComing, CDialog)
  28. //{{AFX_MSG_MAP(PhoneComing)
  29. ON_WM_TIMER()
  30. //}}AFX_MSG_MAP
  31. END_MESSAGE_MAP()
  32. /////////////////////////////////////////////////////////////////////////////
  33. // PhoneComing message handlers
  34. void PhoneComing::SetText(int line, CString str)
  35. {
  36. CString ss;
  37. ss.Format("Ïß·: %d À´µç", line + 1);
  38. SetDlgItemText(IDC_STATIC1, ss);
  39. SetDlgItemText(IDC_STATIC2, str);
  40. SetTimer(1, 10000, NULL);
  41. m_tick = ::GetTickCount();
  42. }
  43. void PhoneComing::OnTimer(UINT nIDEvent)
  44. {
  45. // TODO: Add your message handler code here and/or call default
  46. KillTimer(1);
  47. ShowWindow(SW_HIDE);
  48. CDialog::OnTimer(nIDEvent);
  49. }
  50. BOOL PhoneComing::OnInitDialog()
  51. {
  52. CDialog::OnInitDialog();
  53. // TODO: Add extra initialization here
  54. SetWindowPos(&wndTopMost, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
  55. return TRUE; // return TRUE unless you set the focus to a control
  56. // EXCEPTION: OCX Property Pages should return FALSE
  57. }
  58. void PhoneComing::CheckTimer()
  59. {
  60. KillTimer(1);
  61. if (::GetTickCount() - m_tick > 2000)
  62. ShowWindow(SW_HIDE);
  63. else
  64. {
  65. SetTimer(1, 2000, NULL);
  66. }
  67. }