GetPropertyMetrics Method
GetPropertyMetrics Method |
Returns the metrics data for a specified property.
Declaration
[C++]
HRESULT GetPropertyMetrics (
[in] BSTR property,
[out] long min,
[out] long max,
[out] TabletPropertyMetricUnit *units,
[out] float *resolution
);
[Microsoft® Visual Basic® 6.0]
Public Sub GetPropertyMetrics( _
property As String, _
min As Long, _
max As Long, _
units As TabletPropertyMetricUnit, _
resolution As Single _
)
Parameters
property
[in] The property for which you want to determine metrics.
For more information about the BSTR data type, see Using the Automation Library.
min
[out] The minimum value, in logical units, that the tablet reports for this property. For example, a tablet reporting x-values from 0 to 9000 has a logical minimum of 0.
max
[out] The maximum value, in logical units, that the tablet reports for this property. For example, a tablet reporting x-values from 0 to 9000 would have a logical maximum of 9000.
units
[out] The physical units of the property, such as inches or degrees. For a list of property units, see the TabletPropertyMetricUnit enumeration type.
resolution
[out] Specifies the resolution or increment value for the units member. For example, a tablet that reports 400 dots per inch (dpi) has a resolution value of 400.
Return Value
HRESULT value | Description |
---|---|
S_OK | Success. |
TPC_E_UNKNOWN_PROPERTY | The tablet does not support the specified property. |
E_FAIL | An unspecified error occurred. |
E_POINTER | A parameter contained an invalid pointer. |
CO_E_CLASSSTRING | Invalid GUID format. |
E_INVALIDARG | Unknown property string. |
E_INK_EXCEPTION | An exception occurred while processing. |
Remarks
The properties for which you retrieve metrics may include the time that a packet was generated or the downward pressure of the pen tip on the tablet surface.
For a complete list of properties for which you can retrieve metrics, see the PacketProperty constants.
Example
[Visual Basic 6.0]
This Visual Basic 6.0 example reports on the properties in each tablet that are available in the InkTablets collection.
Dim theInkCollector As InkCollector
Private Sub Command1_Click()
Text1.Text = ReportOnEachTablet()
End Sub
Private Sub Form_Load()
Set theInkCollector = New InkCollector
theInkCollector.hWnd = Me.hWnd
theInkCollector.Enabled = True
End Sub
Public Function ReportOnEachTablet() As String
Dim theTablets As InkTablets
Set theTablets = New InkTablets
Dim theReport As String
theReport = vbCrLf
'Iterate over the tablets in the collection,
'reporting on each one.
Dim theTablet As IInkTablet
For Each theTablet In theTablets
theReport = theReport & "Tablet Name: " & theTablet.name & vbCrLf
If theTablets.DefaultTablet.name = theTablet.name Then
theReport = theReport & "(Default)" & vbCrLf
End If
theReport = theReport & "PlugAndPlayId: " & _
theTablet.PlugAndPlayId & vbCrLf
theReport = theReport & "HardwareCapabilities: " & _
theTablet.HardwareCapabilities & vbCrLf
If (theTablet.HardwareCapabilities And _
THWC_CursorMustTouch) <> 0 Then
theReport = theReport & " CursorMustTouch" & vbCrLf
End If
If (theTablet.HardwareCapabilities And _
THWC_CursorsHavePhysicalIds) <> 0 Then
theReport = theReport & " CursorsHavePhysicalIds" & vbCrLf
End If
If (theTablet.HardwareCapabilities And _
THWC_HardProximity) <> 0 Then
theReport = theReport & " HardProximity" & vbCrLf
End If
If (theTablet.HardwareCapabilities And _
THWC_Integrated) <> 0 Then
theReport = theReport & " Integrated" & vbCrLf
End If
On Error Resume Next
theReport = theReport & "MaximumInputRectangle " & _
theTablet.MaximumInputRectangle & vbCrLf
'Report on each supported Packet Property.
theReport = theReport & "IsPacketPropertySupported:" & vbCrLf
theReport = theReport & GetProperty(theTablet, _
AltitudeOrientation, _
"AltitudeOrientation")
theReport = theReport & GetProperty(theTablet, _
AzimuthOrientation, _
"AzimuthOrientation")
theReport = theReport & GetProperty(theTablet, _
ButtonPressure, "ButtonPressure")
theReport = theReport & GetProperty(theTablet, _
NormalPressure, "NormalPressure")
theReport = theReport & GetProperty(theTablet, _
PacketStatus, "PacketStatus")
theReport = theReport & GetProperty(theTablet, _
PitchRotation, "PitchRotation")
theReport = theReport & GetProperty(theTablet, _
RollRotation, "RollRotation")
theReport = theReport & GetProperty(theTablet, _
SerialNumber, "SerialNumber")
theReport = theReport & GetProperty(theTablet, _
TangentPressure, "TangentPressure")
theReport = theReport & GetProperty(theTablet, _
TimerTick, "TimerTick")
theReport = theReport & GetProperty(theTablet, _
TwistOrientation, "TwistOrientation")
theReport = theReport & GetProperty(theTablet, X, "X")
theReport = theReport & GetProperty(theTablet, _
XTiltOrientation, "XTiltOrientation")
theReport = theReport & GetProperty(theTablet, Y, "Y")
theReport = theReport & GetProperty(theTablet, _
YawRotation, "YawRotation")
theReport = theReport & GetProperty(theTablet, _
YTiltOrientation, "YTiltOrientation")
theReport = theReport & GetProperty(theTablet, Z, "Z")
theReport = theReport & vbCrLf
Next
ReportOnEachTablet = theReport
End Function
Public Function GetProperty( _
ByVal theTablet As IInkTablet, _
ByVal theGuid As String, _
ByVal name As String) _
As String
Dim theReport As String
Dim theMin As Long
Dim theMax As Long
Dim theUnits As TabletPropertyMetricUnit
Dim theResolution As Single
' If this particular property is supported,
' report the name and property metrics information.
If theTablet.IsPacketPropertySupported(theGuid) Then
theTablet.GetPropertyMetrics _
theGuid, theMin, theMax, theUnits, theResolution
theReport = " " & name & vbCrLf & _
" Max: " & theMax & vbCrLf & _
" Min: " & theMin & vbCrLf & _
" Resolution: " & theResolution & _
vbCrLf & _
" Units: " & theUnits & vbCrLf
End If
GetProperty = theReport
End Function