AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Maus in Win10 Konsole verwenden?

Ein Thema von delphifan2004 · begonnen am 25. Sep 2017
Antwort Antwort
delphifan2004

Registriert seit: 26. Nov 2004
Ort: Dresden
274 Beiträge
 
Delphi 10.3 Rio
 
#1

Maus in Win10 Konsole verwenden?

  Alt 25. Sep 2017, 08:34
Hallo,

ich habe die folgende Mausfunktion geschrieben:

Leider erhalte ich die Mausereignisse nicht. Warum?

Delphi-Quellcode:
function PollMouseEv(var Msg: TMsg; wnd: HWND; wMsgFilterMin,wMsgFilterMax: UINT): Boolean;
var
  wmmou: TWMMOUSE;
  moupressed: Boolean;
begin
  if PollMouseEvent(Mouse_Event) then GetMouseEvent(Mouse_Event);
  case Mouse_Event.Buttons of
   MouseLeftButton:
     begin
       wmmou.msg := WM_LBUTTONDOWN;
       moupressed := true;
       wmmou.keys := MouseLeftButton;
       wmmou.XPos := MouseWhereX;
       wmmou.YPos := MouseWhereY;
       Msg.message := WM_LBUTTONDOWN;
       Msg.WParam := wmmou.keys;
       Msg.LParam := (wmmou.YPos shl 16) + wmmou.XPos;
       Msg.pt.X := wmmou.XPos;
       Msg.pt.Y := wmmou.YPos;
       Result := true;
     end;
   MouseMiddleButton:
     begin
       wmmou.msg := WM_MBUTTONDOWN;
       wmmou.keys := MouseMiddleButton;
       wmmou.XPos := MouseWhereX;
       wmmou.YPos := MouseWhereY;
       moupressed := true;
       Msg.message := WM_MBUTTONDOWN;
       Msg.WParam := wmmou.keys;
       Msg.LParam := (wmmou.YPos shl 16) + wmmou.XPos;
       Msg.pt.X := wmmou.XPos;
       Msg.pt.Y := wmmou.YPos;
       Result := true;
     end;
   MouseRightButton:
     begin wmmou.msg := WM_RBUTTONDOWN;
       wmmou.keys := MouseRightButton;
       wmmou.XPos := MouseWhereX;
       wmmou.YPos := MouseWhereY;
       moupressed := true;
       Msg.message := WM_RBUTTONDOWN;
       Msg.WParam := wmmou.keys;
       Msg.LParam := (wmmou.YPos shl 16) + wmmou.XPos;
       Msg.pt.X := wmmou.XPos;
       Msg.pt.Y := wmmou.YPos;
       Result := true;
     end;
  end;
  case Mouse_Event.Action of
   MouseActionDown:
     begin
       case Mouse_Event.buttons of
        MouseLeftButton:
          begin
            wmmou.msg := WM_LBUTTONDOWN; writeln('MouseAction --- WM_LBUTTON------>DOWN');
            wmmou.keys := MouseLeftButton;
            wmmou.XPos := MouseWhereX;
            wmmou.YPos := MouseWhereY;
            Msg.message := wmmou.msg;
            Msg.WParam := wmmou.keys;
            Msg.LParam := (wmmou.YPos shl 16) + wmmou.XPos;
            Msg.pt.X := wmmou.XPos;
            Msg.pt.Y := wmmou.YPos;
            Result := true;
            moupressed := true;
          end;
        MouseMiddleButton:
          begin
            wmmou.msg := WM_MBUTTONDOWN; writeln('MouseAction --- WM_MBUTTON--->DOWN');
            wmmou.keys := MouseMiddleButton;
            wmmou.XPos := MouseWhereX;
            wmmou.YPos := MouseWhereY;
            Msg.message := wmmou.msg;
            Msg.WParam := wmmou.keys;
            Msg.LParam := (wmmou.YPos shl 16) + wmmou.XPos;
            Msg.pt.X := wmmou.XPos;
            Msg.pt.Y := wmmou.YPos;
            Result := true;
            moupressed := true;
          end;
        MouseRightButton:
          begin
            wmmou.msg := WM_RBUTTONDOWN; writeln('MouseAction --- WM_RBUTTON--->DOWN');
            wmmou.keys := MouseRightButton;
            wmmou.XPos := MouseWhereX;
            wmmou.YPos := MouseWhereY;
            Msg.message := wmmou.msg;
            Msg.WParam := wmmou.keys;
            Msg.LParam := (wmmou.YPos shl 16) + wmmou.XPos;
            Msg.pt.X := wmmou.XPos;
            Msg.pt.Y := wmmou.YPos;
            Result := true;
            moupressed := true;
          end;
       end;
     end;
   MouseActionMove:
     begin
       case Mouse_Event.buttons of
        MouseLeftButton:
          begin
            wmmou.msg := WM_MOUSEMOVE; writeln('MouseAction --- WM_LBUTTON--->Mouse Move');
            wmmou.keys := MouseLeftButton;
            wmmou.XPos := MouseWhereX;
            wmmou.YPos := MouseWhereY;
            Msg.message := wmmou.msg;
            Msg.WParam := wmmou.keys;
            Msg.LParam := (wmmou.YPos shl 16) + wmmou.XPos;
            Msg.pt.X := wmmou.XPos;
            Msg.pt.Y := wmmou.YPos;
            Result := true;
            moupressed := true;
          end;
        MouseMiddleButton:
          begin
            wmmou.msg := WM_MOUSEMOVE; writeln('MouseAction --- WM_MBUTTON--->Mouse Move');
            wmmou.keys := MouseMiddleButton;
            wmmou.XPos := MouseWhereX;
            wmmou.YPos := MouseWhereY;
            Msg.message := wmmou.msg;
            Msg.WParam := wmmou.keys;
            Msg.LParam := (wmmou.YPos shl 16) + wmmou.XPos;
            Msg.pt.X := wmmou.XPos;
            Msg.pt.Y := wmmou.YPos;
            Result := true;
            moupressed := true;
          end;
        MouseRightButton:
          begin
            wmmou.msg := WM_MOUSEMOVE; writeln('MouseAction --- WM_RBUTTON--->Mouse Move');
            wmmou.keys := MouseRightButton;
            wmmou.XPos := MouseWhereX;
            wmmou.YPos := MouseWhereY;
            Msg.message := wmmou.msg;
            Msg.WParam := wmmou.keys;
            Msg.LParam := (wmmou.YPos shl 16) + wmmou.XPos;
            Msg.pt.X := wmmou.XPos;
            Msg.pt.Y := wmmou.YPos;
            Result := true;
            moupressed := true;
          end;
       end;
     end;
   MouseActionUp:
     begin
       case Mouse_Event.Buttons of
        MouseLeftButton:
          begin
            wmmou.msg := WM_LBUTTONUP; writeln('MouseAction --- WM_LBUTTON--->UP');
            wmmou.keys := MouseLeftButton;
            wmmou.XPos := MouseWhereX;
            wmmou.YPos := MouseWhereY;
            Msg.message := wmmou.msg;
            Msg.WParam := wmmou.keys;
            Msg.LParam := (wmmou.YPos shl 16) + wmmou.XPos;
            Msg.pt.X := wmmou.XPos;
            Msg.pt.Y := wmmou.YPos;
            Result := true;
            moupressed := false;
          end;
        MouseMiddleButton:
          begin
            wmmou.msg := WM_MBUTTONUP; writeln('MouseAction --- WM_MBUTTON--->UP');
            wmmou.keys := MouseMiddleButton;
            wmmou.XPos := MouseWhereX;
            wmmou.YPos := MouseWhereY;
            Msg.message := wmmou.msg;
            Msg.WParam := wmmou.keys;
            Msg.LParam := (wmmou.YPos shl 16) + wmmou.XPos;
            Msg.pt.X := wmmou.XPos;
            Msg.pt.Y := wmmou.YPos;
            Result := true;
            moupressed := false;
          end;
        MouseRightButton:
          begin
            wmmou.msg := WM_RBUTTONUP; writeln('MouseAction --- WM_RBUTTON--->UP');
            wmmou.keys := MouseRightButton;
            wmmou.XPos := MouseWhereX;
            wmmou.YPos := MouseWhereY;
            Msg.message := wmmou.msg;
            Msg.WParam := wmmou.keys;
            Msg.LParam := (wmmou.YPos shl 16) + wmmou.XPos;
            Msg.pt.X := wmmou.XPos;
            Msg.pt.Y := wmmou.YPos;
            Result := true;
            moupressed := false;
          end;
       end;
     end;
  end;
end;
Ich verwende Lazarus 1.6.4 mit Freepascal 3.0.2

.

Geändert von delphifan2004 (25. Sep 2017 um 08:48 Uhr)
  Mit Zitat antworten Zitat
Antwort Antwort


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 18:33 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz