📄 simute~3.cpp
字号:
// SimuteCursorView.cpp : implementation of the CSimuteCursorView class
//
#include "stdafx.h"
#include "SimuteCursor.h"
#include "SimuteCursorDoc.h"
#include "SimuteCursorView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSimuteCursorView
IMPLEMENT_DYNCREATE(CSimuteCursorView, CFormView)
BEGIN_MESSAGE_MAP(CSimuteCursorView, CFormView)
//{{AFX_MSG_MAP(CSimuteCursorView)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CFormView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CFormView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CFormView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSimuteCursorView construction/destruction
CSimuteCursorView::CSimuteCursorView()
: CFormView(CSimuteCursorView::IDD)
{
//{{AFX_DATA_INIT(CSimuteCursorView)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// TODO: add construction code here
}
CSimuteCursorView::~CSimuteCursorView()
{
}
void CSimuteCursorView::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSimuteCursorView)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BOOL CSimuteCursorView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CFormView::PreCreateWindow(cs);
}
void CSimuteCursorView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
GetParentFrame()->RecalcLayout();
ResizeParentToFit();
}
/////////////////////////////////////////////////////////////////////////////
// CSimuteCursorView printing
BOOL CSimuteCursorView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CSimuteCursorView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CSimuteCursorView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
void CSimuteCursorView::OnPrint(CDC* pDC, CPrintInfo* /*pInfo*/)
{
// TODO: add customized printing code here
}
/////////////////////////////////////////////////////////////////////////////
// CSimuteCursorView diagnostics
#ifdef _DEBUG
void CSimuteCursorView::AssertValid() const
{
CFormView::AssertValid();
}
void CSimuteCursorView::Dump(CDumpContext& dc) const
{
CFormView::Dump(dc);
}
CSimuteCursorDoc* CSimuteCursorView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CSimuteCursorDoc)));
return (CSimuteCursorDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CSimuteCursorView message handlers
void CSimuteCursorView::OnButton1()
{
POINT lpPoint;
CRect rect;
CWnd*pParent=AfxGetApp()->GetMainWnd();
pParent->GetWindowRect(&rect);
lpPoint.x=rect.left+50;
lpPoint.y=rect.top+10;
SetCursorPos(lpPoint.x,lpPoint.y);
mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);
mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);
// TODO: Add your control notification handler code here
}
void CSimuteCursorView::OnButton2()
{
POINT lpPoint;
CRect rect;
CWnd*pParent=AfxGetApp()->GetMainWnd();
pParent->GetWindowRect(&rect);
lpPoint.x=rect.left+5;
lpPoint.y=rect.top+15;
SetCursorPos(lpPoint.x,lpPoint.y);
mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);
// TODO: Add your control notification handler code here
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -