Einzelnen Beitrag anzeigen

Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
44.063 Beiträge
 
Delphi 12 Athens
 
#7

AW: Multitouch Anwendung unter Delphi 7

  Alt 21. Nov 2010, 23:06
oder eventuell auch so
Delphi-Quellcode:
procedure TForm1.WMTOUCH(var Msg: TMessage);
var
  TouchInputs: array of TTouchInput;
  TouchPoints: array of TPoint;
  counter: Integer;
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;


  // ...
  for counter := 0 to High(TouchPoints) do begin
    // TouchPoints[counter]

  end;
  // ...

  inherited;
end;

und alles zusammen, aber dennoch getrennt
Delphi-Quellcode:
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;
Neuste Erkenntnis:
Seit Pos einen dritten Parameter hat,
wird PoSex im Delphi viel seltener praktiziert.

Geändert von himitsu (21. Nov 2010 um 23:15 Uhr)
  Mit Zitat antworten Zitat