共用方式為


IsPacketPropertySupported Method

IsPacketPropertySupported Method

Determines whether a property of a tablet device or a collection of tablet devices, identified with a globally unique identifier (GUID), is supported.

For example, use this method to determine if all of the tablets in a collection support tangential pressure from a pen.

Declaration

[C++]

HRESULT IsPacketPropertySupported (
    [in] BSTR packetProperty,
    [out, retval] VARIANT_BOOL *Supported
);

[Microsoft® Visual Basic® 6.0]

Public Function IsPacketPropertySupported( _
    packetProperty As String _
) As Boolean;

Parameters

packetProperty

[in] The GUID for the PacketProperty of the tablet or tablets that is requested. Use a defined BSTR constant from the PacketProperty constants.

For more information about the BSTR data type, see Using the Automation Library.

Supported

[out] Returns the Boolean value that indicates whether a known property is supported by the tablet or tablets. The value is TRUE if the property is supported; otherwise, FALSE.

Return Value

HRESULT value Description
S_OK Success.
E_POINTER A parameter contained an invalid pointer.
CO_E_CLASSSTRING Invalid GUID format.
E_INK_EXCEPTION An exception occurred while processing.
E_INVALIDARG The flag is invalid.

Remarks

Note: When this method is called on the InkTablets collection, it queries all of the tablets on the system. If any of them does not support the property, it returns FALSE. Call IsPacketPropertySupported on an individual IInkTablet object to determine whether the device supports a known property.

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

Applies To