Freigeben über


SetEventInterest Method (Automation Only)

SetEventInterest Method (Automation Only)

Sets a value that indicates whether an object or control has interest in a specified event.

Declaration

[C++]

HRESULT SetEventInterest (
    [in] InkCollectorEventInterest eventId,
    [in] VARIANT_BOOL listen
);

[Microsoft® Visual Basic® 6.0]

Public Sub SetEventInterest( _
    eventId As InkCollectorEventInterest, _
    listen As Boolean _
)

Parameters

eventId

[in] The event to be listened for. Possible values for eventID appear in the InkCollectorEventInterest enumeration type.

Note: In Visual Basic 6.0, the ICEI_AllEvents flag does not appear in the Object Browser or the IntelliSense menus, but can still be accessed by name.

listen

Specifies whether the event is being listened for. The value is TRUE if the event is being used and FALSE if it is being ignored.

Return Value

HRESULT value Description
S_OK Success.
E_POINTER A parameter contained an invalid pointer.
E_INVALIDARG Invalid event interest.
E_INK_EXCEPTION An exception occurred during processing.

Remarks

All ink collector events can be toggled by using this method. Most of these events are turned off by default for performance reasons. The only events that are on by default are Stroke, CursorInRange, and CursorOutOfRange.

Use the NewPackets, NewInAirPackets and CursorDown events carefully, in particular because they may have an adverse effect on ink performance if too much code is executed in the event handlers.

Example

[Visual Basic 6.0]

This Visual Basic 6.0 example calls SetEventInterest on several cursor button events in a new InkCollector object in order to display information in a text box as the events are received.

Option Explicit
Dim WithEvents theInkCollector As InkCollector

Private Sub Form_Load()
    Set theInkCollector = New InkCollector
    theInkCollector.hWnd = Me.hWnd
    theInkCollector.Enabled = True

    theInkCollector.SetEventInterest ICEI_CursorButtonUp, True
    theInkCollector.SetEventInterest ICEI_CursorButtonDown, True
    theInkCollector.SetEventInterest ICEI_CursorDown, True
End Sub

Private Sub theInkCollector _CursorButtonUp(ByVal Cursor As MSINKAUTLib.IInkCursor, ByVal Button As MSINKAUTLib.IInkCursorButton)
    Text1.Text = "Cursor " & Cursor.Name & "." & Button.Name & " button up"
End Sub

Private Sub theInkCollector_CursorButtonDown(ByVal Cursor As MSINKAUTLib.IInkCursor, ByVal Button As MSINKAUTLib.IInkCursorButton)
    Text1.Text = "Cursor " & Cursor.Name & "." & Button.Name & " button down"
End Sub

Private Sub theInkCollector_CursorDown(ByVal Cursor As MSINKAUTLib.IInkCursor, ByVal Stroke As MSINKAUTLib.IInkStrokeDisp)
    'Text1.Text = "Cursor " & Cursor.Name & " down"
End Sub

Private Sub theInkCollector_CursorInRange(ByVal Cursor As MSINKAUTLib.IInkCursor, ByVal NewCursor As Boolean, ByVal ButtonsState As Variant)
    Text1.Text = "Cursor " & Cursor.Name & " in range, new is " & NewCursor
End Sub

Private Sub theInkCollector_CursorOutOfRange(ByVal Cursor As MSINKAUTLib.IInkCursor)
    Text1.Text = "Cursor " & Cursor.Name & " out of range"
End Sub

Applies To