SetPacketValuesByProperty Method

SetPacketValuesByProperty Method

Sets the packet values for a particular property.

Declaration

[C++]

HRESULT SetPacketValuesByProperty(
    [in] BSTR id,
    [in] VARIANT packetValues,
    [in, optional, defaultvalue(ISC_FirstElement)] long index,
    [in, optional, defaultvalue(ISC_AllElements)] long count,
    [out, retval] long* NumberOfPacketsSet
);
      

[Microsoft® Visual Basic® 6.0]

Public Function SetPacketValuesByProperty( _
    id As String, _
    packetValues, _
    [index As Long], _
    [count As Long = -1] _
) As Long
      

Parameters

id

[in] The globally unique identifier (GUID) identifier from the PacketProperty constants that is used to select which packet data is set. Use PacketDescription to determine the defined properties for this stroke.

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

index

[in, optional] The starting index of the packet to be modified. The default value ISC_FirstElement, defined in the ItemSelectionConstants enumeration type, specifies the first packet.

count

[in, optional] Specifies the number of packets in the stroke to modify and the number of values in packetValues. The default value ISC_AllElements, defined in the ItemSelectionConstants enumeration type, specifies that all packets are modified.

packetValues

[in] The array of packet data values. The method fails if any of the values in the array are outside the minimum or maximum value of the property. To determine the range of values in the property, call the GetPacketDescriptionPropertyMetrics method.

For more information about the VARIANT structure, see Using the Automation Library.

NumberOfPacketsSet

[out, retval] The actual number of packets set.

Return Value

HRESULT value Description
S_OK Success.
E_POINTER A parameter contained an invalid pointer.
CO_E_CLASSSTRING Invalid GUID format.
E_INVALIDARG Invalid variant, index (out of range), or property GUID.
E_INK_EXCEPTION An exception occurred inside method.

Example

[Visual Basic 6.0]

This Visual Basic 6.0 example shows how to set the NormalPressure property to a constant value for every packet in the IInkStrokeDisp theStroke. The packet property GUID strings such as NormalPressure are defined in InkConstants.bas in the Include directory of the Microsoft Windows® XP Tablet PC Edition Software Development Kit (SDK).

    '...
    Dim theNewValues() As Integer
    ReDim theNewValues(Stroke.PacketCount)
    Dim i As Integer
    For i = 0 To Stroke.PacketCount - 1
        theNewValues(i) = 6
    Next
    Dim PacketsSet As Long
    PacketsSet = _
        Stroke.SetPacketValuesByProperty(NormalPressure, theNewValues)
    '...
      

Applies To