Steve Maughan
Steve Maughan

Reputation: 1264

How To Program in Delphi for Microsoft's Surface Pen?

I'd like to integrate surface pen capabilities into my application. It's written using Delphi 10 Seattle. I've searched all over the web and can't find anything.

Does anyone know how to program for the Pen? Specifically, to capture the pressure level, pen down, pen up and pen move events.

Upvotes: 5

Views: 712

Answers (1)

Ian Boyd
Ian Boyd

Reputation: 256731

Your application needs to handle the WM_POINTERUPDATE message.

During that message you can call GetPointerPenInfo to retrieve information about the current status of the pointer as a POINTER_PEN_INFO structure:

POINTER_PEN_INFO = record
   pointerInfo: POINTER_INFO;
   penFlags: PEN_FLAGS;
   penMask: PEN_MASK;
   pressure: UINT32;
   rotation UINT32;
   tiltX: INT32; 
   tiltY: INT32;
end;

Upvotes: 1

Related Questions