type
TForm1 =
class(TForm)
protected
procedure WndProc(
var Message: TMessage);
override;
private
{ Private declarations }
public
{ Public declarations }
procedure OnTouchPoints(
const TouchPoints: TTouchPoints);
end;
procedure TForm1.WndProc(
var Message: TMessage);
var
TouchInputs:
array of TTouchInput;
TouchPoints:
array of TPoint;
counter: Integer;
begin
if Message.msg = WM_GESTURENOTIFY
then
Msg.Result := DefWindowProc(
Handle, Msg.Msg, Msg.Unused, Longint(Msg.NotifyStruct))
else
if Message.msg = WM_GESTURE
then
Msg.Result := DefWindowProc(
Handle, Msg.Msg, Msg.WParam, Msg.LParam)
else
if Message.msg = WM_TABLET_FLICK
then
Msg.Result := DefWindowProc(Form1.Handle, Msg.Msg, Msg.WParam, Msg.LParam)
else
if Message.msg = WM_TOUCH
then
begin
SetLength(TouchInputs, Msg.WParam);
SetLength(TouchPoints, Msg.WParam);
GetTouchInputInfo(Msg.LParam, Msg.WParam, @TouchInputs[0], SizeOf(TTouchInput));
CloseTouchInputHandle(Msg.LParam);
for counter := 0
to High(TouchInputs)
do
begin
TouchPoints[counter] := Point(TouchInputs[counter].X
div 100, TouchInputs[counter].Y
div 100);
PhysicalToLogicalPoint(
Handle, TouchPoints[counter]);
end;
OnTouchPoints(TouchPoints);
inherited;
end else
inherited;
end;
procedure TForm1.OnTouchPoints(
const TouchPoints: TTouchPoints);
begin
// ...
end;