共用方式為


pointerType property

Returns whether the source of the event is touch, pen or mouse.

This property is read-only.

 

Syntax

HRESULT get_pointerType(
  [out] long *ptr
);

Property values

Type: long

MSPOINTER_TYPE_TOUCH (0x00000002)

MSPOINTER_TYPE_PEN (0x00000003)

MSPOINTER_TYPE_MOUSE (0x00000004)

Remarks

The following example uses IMSPointerPoint::pointerType to check whether a pointer is primary from inside events other than IHTMLDocument8::onmspointerdown.

elm.addEventListener("MSPointerDown",handleDown,false);
function handleDown(evt) {
  if(evt.pointerType == evt.MSPOINTER_TYPE_TOUCH) {
    // Do something for touch input only
  }else{
    // Do something for non-touch input
  }
}

See also

isPrimary