📄 devicepage.cpp
字号:
// DevicePage.cpp : implementation file
//
#include "stdafx.h"
#include "SynView.h"
#include "DevicePage.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDevicePage property page
IMPLEMENT_DYNCREATE(CDevicePage, CPropertyPage)
CDevicePage::CDevicePage() : CPropertyPage(CDevicePage::IDD)
{
//{{AFX_DATA_INIT(CDevicePage)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
CDevicePage::~CDevicePage()
{
}
void CDevicePage::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDevicePage)
DDX_Control(pDX, IDC_PROPERTY, m_PropertyList);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDevicePage, CPropertyPage)
//{{AFX_MSG_MAP(CDevicePage)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
struct PropertyDescriptor
{
long lSpecifier;
char *szName;
long lType;
};
#define SPPARAM(name, type) SP_##name, #name, type
static PropertyDescriptor Properties[] =
{
SPPARAM(Handle, 0),
SPPARAM(DeviceType, 0),
SPPARAM(ConnectionType, 0),
SPPARAM(FWVersion, 0),
SPPARAM(Geometry, 0),
SPPARAM(SensorType, 0),
SPPARAM(ProductType, 0),
SPPARAM(ASICType, 0),
SPPARAM(DriverVersion, 0),
SPPARAM(ReportRate, 0),
SPPARAM(Gestures, 0),
SPPARAM(SecondaryGestures, 0),
SPPARAM(EdgeMotionOptions, 0),
SPPARAM(EdgeMotionSpeed, 0),
SPPARAM(MotionRotationAngle, 0),
SPPARAM(XDPI, 0),
SPPARAM(YDPI, 0),
SPPARAM(XLoSensor, 0),
SPPARAM(YLoSensor, 0),
SPPARAM(XHiSensor, 0),
SPPARAM(YHiSensor, 0),
SPPARAM(XLoRim, 0),
SPPARAM(YLoRim, 0),
SPPARAM(XHiRim, 0),
SPPARAM(YHiRim, 0),
SPPARAM(XLoBorder, 0),
SPPARAM(YLoBorder, 0),
SPPARAM(XHiBorder, 0),
SPPARAM(YHiBorder, 0),
SPPARAM(YLoBorderVScroll, 0),
SPPARAM(YHiBorderVScroll, 0),
SPPARAM(XLoWideBorder, 0),
SPPARAM(YLoWideBorder, 0),
SPPARAM(XHiWideBorder, 0),
SPPARAM(YHiWideBorder, 0),
SPPARAM(ZMaximum, 0),
SPPARAM(ZTouchThreshold, 0),
SPPARAM(TopLeftCornerWidth, 0),
SPPARAM(TopLeftCornerHeight, 0),
SPPARAM(TopRightCornerWidth, 0),
SPPARAM(TopRightCornerHeight, 0),
SPPARAM(BottomRightCornerWidth, 0),
SPPARAM(BottomRightCornerHeight, 0),
SPPARAM(BottomLeftCornerWidth, 0),
SPPARAM(BottomLeftCornerHeight, 0),
SPPARAM(TopLeftCornerAction, 0),
SPPARAM(TopRightCornerAction, 0),
SPPARAM(BottomRightCornerAction, 0),
SPPARAM(BottomLeftCornerAction, 0),
SPPARAM(LeftButtonAction, 0),
SPPARAM(RightButtonAction, 0),
SPPARAM(BothButtonAction, 0),
SPPARAM(MiddleButtonAction, 0),
SPPARAM(UpButtonAction, 0),
SPPARAM(DownButtonAction, 0),
SPPARAM(Ex1ButtonAction, 0),
SPPARAM(Ex2ButtonAction, 0),
SPPARAM(Ex3ButtonAction, 0),
SPPARAM(Ex4ButtonAction, 0),
SPPARAM(Ex5ButtonAction, 0),
SPPARAM(Ex6ButtonAction, 0),
SPPARAM(Ex7ButtonAction, 0),
SPPARAM(Ex8ButtonAction, 0),
SPPARAM(ExtendedButtons, 0),
SPPARAM(HasUpDownButtons, 0),
SPPARAM(IsMultiFingerCapable, 0),
SPPARAM(IsPenCapable, 0),
SPPARAM(IsVScroll, 0),
SPPARAM(IsHScroll, 0),
SPPARAM(IsWEMode, 0),
SPPARAM(IsLowReportRate, 0),
SPPARAM(IsHighReportRate, 0),
SPPARAM(IsTapEnabled, 0),
SPPARAM(IsDragEnabled, 0),
SPPARAM(IsDragLockEnabled, 0),
SPPARAM(IsCornerTapEnabled, 0),
SPPARAM(IsEdgeMotionEnabled, 0),
SPPARAM(IsEdgeMotionDragEnabled, 0),
SPPARAM(IsEdgeMotionMoveEnabled, 0),
SPPARAM(IsReleaseToSelectEnabled, 0),
SPPARAM(IsMiddleTapToHelpEnabled, 0),
SPPARAM(IsMiddleButtonBlockEnabled, 0),
SPPARAM(IsPressureDragEnabled, 0),
SPPARAM(Is3ButtonEnabled, 0),
SPPARAM(IsPressureEdgeMotionEnabled, 0),
SPPARAM(IsMiddleButtonLock, 0),
SPPARAM(VerticalScrollingFlags, 0),
SPPARAM(HorizontalScrollingFlags, 0),
SPPARAM(ModelString, 1),
SPPARAM(PnPID, 1),
SPPARAM(ShortName, 1),
0, 0, 0 // End of list
};
CString CDevicePage::GetPropertyString(PropertyDescriptor *Descriptor)
{
CString Buffer;
if (!Descriptor->lType)
{
long Prop = m_Device.GetLongProperty(Descriptor->lSpecifier);
Buffer.Format("0x%.8x", Prop);
}
else
{
Buffer = (char *) m_Device.GetStringProperty(Descriptor->lSpecifier);
}
return Buffer;
}
void CDevicePage::AddProperty(PropertyDescriptor *Descriptor)
{
CString Buffer = GetPropertyString(Descriptor);
if (!Buffer.IsEmpty())
{
CString Entry = Descriptor->szName;
Entry += ":\t";
Entry += Buffer;
m_PropertyList.SetItemDataPtr(m_PropertyList.AddString(Entry), Descriptor);
}
}
void CDevicePage::InitProperties()
{
m_PropertyList.ResetContent();
int iTabs[] = { 104, 256 };
m_PropertyList.SetTabStops(2, iTabs);
for (int index = 0; ; index++)
{
if (Properties[index].lSpecifier)
AddProperty(&Properties[index]);
else
break;
}
m_PropertyList.SetHorizontalExtent(400);
}
/////////////////////////////////////////////////////////////////////////////
// CDevicePage message handlers
BOOL CDevicePage::OnInitDialog()
{
CPropertyPage::OnInitDialog();
return TRUE;
}
BOOL CDevicePage::OnDeviceChange()
{
m_Device->Select(m_pView->GetDeviceHandle());
try
{
InitProperties();
}
catch (CException *)
{
m_PropertyList.ResetContent();
}
return 0;
}
BOOL CDevicePage::OnSetActive()
{
OnDeviceChange();
return CPropertyPage::OnSetActive();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -