home *** CD-ROM | disk | FTP | other *** search
/ Master Visual C++ 1.5 / MASTERVC15.ISO / vcprog / original / ch17 / whereami / wherevw.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1994-01-24  |  1.6 KB  |  77 lines

  1. // wherevw.cpp : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "whereami.h"
  6. #include "wherevw.h"
  7.  
  8. #ifdef _DEBUG
  9. #undef THIS_FILE
  10. static char BASED_CODE THIS_FILE[] = __FILE__;
  11. #endif
  12.  
  13. /////////////////////////////////////////////////////////////////////////////
  14. // CWhereamiView
  15.  
  16. IMPLEMENT_DYNCREATE(CWhereamiView, CFormView)
  17.  
  18. CWhereamiView::CWhereamiView()
  19.     : CFormView(CWhereamiView::IDD)
  20. {
  21.     //{{AFX_DATA_INIT(CWhereamiView)
  22.     m_Horiz = "";
  23.     m_Vert = "";
  24.     //}}AFX_DATA_INIT
  25. }
  26.  
  27. CWhereamiView::~CWhereamiView()
  28. {
  29. }
  30.  
  31. void CWhereamiView::DoDataExchange(CDataExchange* pDX)
  32. {
  33.     CFormView::DoDataExchange(pDX);
  34.     //{{AFX_DATA_MAP(CWhereamiView)
  35.     DDX_Text(pDX, IDC_HORIZ, m_Horiz);
  36.     DDX_Text(pDX, IDC_VERT, m_Vert);
  37.     //}}AFX_DATA_MAP
  38. }
  39.  
  40.  
  41. BEGIN_MESSAGE_MAP(CWhereamiView, CFormView)
  42.     //{{AFX_MSG_MAP(CWhereamiView)
  43.     ON_WM_MOUSEMOVE()
  44.     //}}AFX_MSG_MAP
  45. END_MESSAGE_MAP()
  46.  
  47.  
  48. /////////////////////////////////////////////////////////////////////////////
  49. // CWhereamiView message handlers
  50.  
  51.  
  52. void CWhereamiView::OnMouseMove(UINT nFlags, CPoint point)
  53. {
  54.     // TODO: Add your message handler code here and/or call default
  55.  
  56.  
  57.      //////////////////////
  58.      // MY CODE STARTS HERE
  59.      //////////////////////
  60.      char XPosition[10];
  61.      char YPosition[10];
  62.  
  63.      itoa ( point.x, XPosition, 10 );
  64.      itoa ( point.y, YPosition, 10 );
  65.  
  66.      m_Horiz = XPosition;
  67.      m_Vert = YPosition;
  68.  
  69.      UpdateData(FALSE);
  70.  
  71.      ////////////////////
  72.      // MY CODE ENDS HERE
  73.      ////////////////////
  74.     
  75.     CFormView::OnMouseMove(nFlags, point);
  76. }
  77.