Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 326
Steve Maughan Avatar asked Nov 08 '22 20:11

Steve Maughan


1 Answers

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;
like image 135
Ian Boyd Avatar answered Nov 15 '22 07:11

Ian Boyd