home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / com / acdual / server / aclikvw.cpp < prev    next >
C/C++ Source or Header  |  1998-04-02  |  3KB  |  123 lines

  1. // AClikVw.cpp : implementation of the CAutoClickView class
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1992-1998 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Microsoft Foundation Classes Reference and related
  9. // electronic documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12.  
  13. #include "stdafx.h"
  14. #include "AutoClik.h"
  15.  
  16. #include "AClikDoc.h"
  17. #include "AClikVw.h"
  18.  
  19. #ifdef _DEBUG
  20. #define new DEBUG_NEW
  21. #undef THIS_FILE
  22. static char THIS_FILE[] = __FILE__;
  23. #endif
  24.  
  25. /////////////////////////////////////////////////////////////////////////////
  26. // CAutoClickView
  27.  
  28. IMPLEMENT_DYNCREATE(CAutoClickView, CView)
  29.  
  30. BEGIN_MESSAGE_MAP(CAutoClickView, CView)
  31.     //{{AFX_MSG_MAP(CAutoClickView)
  32.     ON_WM_LBUTTONDOWN()
  33.     //}}AFX_MSG_MAP
  34.     // Standard printing commands
  35.     ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
  36.     ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
  37.     ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
  38. END_MESSAGE_MAP()
  39.  
  40. /////////////////////////////////////////////////////////////////////////////
  41. // CAutoClickView construction/destruction
  42.  
  43. CAutoClickView::CAutoClickView()
  44. {
  45.     // TODO: add construction code here
  46.  
  47. }
  48.  
  49. CAutoClickView::~CAutoClickView()
  50. {
  51. }
  52.  
  53. BOOL CAutoClickView::PreCreateWindow(CREATESTRUCT& cs)
  54. {
  55.     // TODO: Modify the Window class or styles here by modifying
  56.     //  the CREATESTRUCT cs
  57.  
  58.     return CView::PreCreateWindow(cs);
  59. }
  60.  
  61. /////////////////////////////////////////////////////////////////////////////
  62. // CAutoClickView drawing
  63.  
  64. void CAutoClickView::OnDraw(CDC* pDC)
  65. {
  66.     CAutoClickDoc* pDoc = GetDocument();
  67.     ASSERT_VALID(pDoc);
  68.  
  69.     pDC->TextOut(pDoc->m_pt.x, pDoc->m_pt.y, pDoc->m_str);
  70. }
  71.  
  72. /////////////////////////////////////////////////////////////////////////////
  73. // CAutoClickView printing
  74.  
  75. BOOL CAutoClickView::OnPreparePrinting(CPrintInfo* pInfo)
  76. {
  77.     // default preparation
  78.     return DoPreparePrinting(pInfo);
  79. }
  80.  
  81. void CAutoClickView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
  82. {
  83.     // TODO: add extra initialization before printing
  84. }
  85.  
  86. void CAutoClickView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
  87. {
  88.     // TODO: add cleanup after printing
  89. }
  90.  
  91. /////////////////////////////////////////////////////////////////////////////
  92. // CAutoClickView diagnostics
  93.  
  94. #ifdef _DEBUG
  95. void CAutoClickView::AssertValid() const
  96. {
  97.     CView::AssertValid();
  98. }
  99.  
  100. void CAutoClickView::Dump(CDumpContext& dc) const
  101. {
  102.     CView::Dump(dc);
  103. }
  104.  
  105. CAutoClickDoc* CAutoClickView::GetDocument() // non-debug version is inline
  106. {
  107.     ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CAutoClickDoc)));
  108.     return (CAutoClickDoc*)m_pDocument;
  109. }
  110. #endif //_DEBUG
  111.  
  112. /////////////////////////////////////////////////////////////////////////////
  113. // CAutoClickView message handlers
  114.  
  115. void CAutoClickView::OnLButtonDown(UINT nFlags, CPoint point)
  116. {
  117.     CAutoClickDoc* pDoc = GetDocument();
  118.     pDoc->m_pt = point;
  119.     pDoc->Refresh();
  120.  
  121.     CView::OnLButtonDown(nFlags, point);
  122. }
  123.