AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Sprachen und Entwicklungsumgebungen Sonstige Fragen zu Delphi Delphi Mouseposition innerhalb des Forms bestimmen
Thema durchsuchen
Ansicht
Themen-Optionen

Mouseposition innerhalb des Forms bestimmen

Offene Frage von "skyquaker"
Ein Thema von skyquaker · begonnen am 8. Feb 2007 · letzter Beitrag vom 10. Feb 2007
 
skyquaker

Registriert seit: 14. Sep 2006
96 Beiträge
 
Delphi 7 Professional
 
#8

Re: Mouseposition innerhalb des Forms bestimmen

  Alt 10. Feb 2007, 13:23
Das mit der Mausposition geht sehr gut, nur leider krieg ich es nicht hin das übers Netzwerk zu übertragen.

So hab ichs gemacht:

Server:
Delphi-Quellcode:
function GetPos(Handle: HWND): TPoint;
var
   WinInfo: TWindowInfo;
   CurPos: TPoint;
begin
   Result.X:= -1;
   Result.Y:= -1;
   FillChar(WinInfo, Sizeof(WinInfo), 0);
   WinInfo.cbSize := Sizeof(WinInfo);
   GetWindowInfo(Handle, WinInfo);
   GetCursorPos(CurPos);
   //if windows.PtInRect(WinInfo.rcWindow, CurPos) then
   if windows.PtInRect(WinInfo.rcClient, CurPos) then
     begin
       Result.X:= CurPos.X- WinInfo.rcClient.Left;
       Result.Y:= CurPos.Y- WinInfo.rcClient.Top;
     end;
end;
.
.
.
.

procedure TForm1.Server2Execute(AThread: TIdPeerThread);
var mp: TPoint;
begin
mp:= getpos(Form1.Handle);
   with Athread.Connection do
     begin
    WriteInteger(mp.x);
    WriteInteger(mp.y);
   Disconnect;
     end;
end;
Client:
Delphi-Quellcode:
with Client2 do
       begin
          Connect;
            try
               xy.X := ReadInteger(true);
               xy.Y := ReadInteger(true);
            finally
          Disconnect;
         end;
    SetPos(Han,xy);
ShowMEssage(strtoint(xy.X)+'/'+strtoint(xy.y));


procedure SetPos(Handle: HWND; CurPos: TPoint);
var
   WinInfo: TWindowInfo;
begin
   FillChar(WinInfo, Sizeof(WinInfo), 0);
   WinInfo.cbSize := Sizeof(WinInfo);
   GetWindowInfo(Handle, WinInfo);
   inc(CurPos.X, WinInfo.rcClient.Left);//WinInfo.rcWindow.Left
   inc(CurPos.Y, WinInfo.rcClient.Top);//WinInfo.rcWindow.Top
   if windows.PtInRect(WinInfo.rcClient, CurPos) then
   setCursorPos(CurPos.X, CurPos.Y);
end;
Das Problem ist, das es keine Message anzeigt und auch nicht die Mausposition verändert. (Ich kriege aber auch keine Fehler)
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 21:13 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz