Registriert seit: 10. Nov 2013
83 Beiträge
|
AW: How draw password on remote smartphone with mouse?
30. Aug 2018, 22:31
I'm not understood very fine your example above, then i tried follow your hint in my actual code, but without success, until now.
How update correctly PO coordenates on code below?
Delphi-Quellcode:
private
{ Private declarations }
PO, LP: TPoint;
Draw: boolean;
public
{ Public declarations }
end;
...
procedure TForm2.Image1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var
Index, XTouch, YTouch, RXCoord, RYCoord: Integer;
List: TStrings;
RScreen: String;
begin
Index := Form1.ListView1.ItemIndex;
if Index = -1 then
Exit;
List := TStringList.Create;
RScreen := Form1.ListView1.Selected.SubItems[6]; // Remote screen resolution
try
ExtractStrings(['x'], [], PChar(RScreen), List); // Ex: my smartphone is 1920x1080
RYCoord := StrToInt(List[0]); // 1920 (height)
RXCoord := StrToInt(List[1]); // 1080 (width)
finally
List.Free;
end;
XTouch := Round((X / Image1.Width) * RXCoord);
YTouch := Round((Y / Image1.Height) * RYCoord);
PO.X := XTouch;
PO.Y := YTouch;
LP.X := XTouch;
LP.Y := YTouch;
Draw := true;
{ Form1.ServerSocket1.Socket.Connections[Index].SendText('touch' + IntToStr(XTouch) + '<|>' +
IntToStr(YTouch) + #13#10);
}
end;
end;
procedure TForm2.Image1MouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
var
Index, XTouch, YTouch, RXCoord, RYCoord: Integer;
List: TStrings;
RScreen: String;
begin
Index := Form1.ListView1.ItemIndex;
if Index = -1 then
Exit;
List := TStringList.Create;
RScreen := Form1.ListView1.Selected.SubItems[6]; // Remote screen resolution
try
ExtractStrings(['x'], [], PChar(RScreen), List); // Ex: my smartphone is 1920x1080
RYCoord := StrToInt(List[0]); // 1920 (height)
RXCoord := StrToInt(List[1]); // 1080 (width)
finally
List.Free;
end;
XTouch := Round((X / Image1.Width) * RXCoord);
YTouch := Round((Y / Image1.Height) * RYCoord);
if Draw then
begin
LP.X := XTouch;
LP.Y := YTouch;
Form1.ServerSocket1.Socket.Connections[Index].SendText('swipescreen' + IntToStr(PO.X) + '<|>' +
IntToStr(PO.Y) + '<|>' +
IntToStr(LP.X) + '<|>' +
IntToStr(LP.Y) + #13#10);
PO.X := LP.X;
PO.Y := LP.Y;
end;
end;
|
|
Zitat
|