// DriveButton.cpp : implementation file // /* DriveButton is a button subclassed control which calls a function in CMainDlg both when it's pressed down and when it's released in order to stop the motors on the button release */ #include "stdafx.h" #include "serialtester.h" #include "DriveButton.h" #include "MainDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CDriveButton CDriveButton::CDriveButton() { } CDriveButton::~CDriveButton() { } BEGIN_MESSAGE_MAP(CDriveButton, CButton) //{{AFX_MSG_MAP(CDriveButton) ON_WM_LBUTTONDOWN() ON_WM_LBUTTONUP() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CDriveButton message handlers void CDriveButton::PreSubclassWindow() { CButton::PreSubclassWindow(); } void CDriveButton::OnLButtonDown(UINT nFlags, CPoint point) { ((CMainDlg*)GetParent())->OnDriveButton(GetDlgCtrlID()); CButton::OnLButtonDown(nFlags, point); } void CDriveButton::OnLButtonUp(UINT nFlags, CPoint point) { ((CMainDlg*)GetParent())->OnDriveBtnUp(GetDlgCtrlID()); CButton::OnLButtonUp(nFlags, point); }