Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi Überprüfen ob STRG gedrückt ist (https://www.delphipraxis.net/43470-ueberpruefen-ob-strg-gedrueckt-ist.html)

Nicolai1234 4. Apr 2005 18:33


Überprüfen ob STRG gedrückt ist
 
Hallo,
wie kann man überprüfen ob die Taste STRG (bzw. ALT) gedrückt ist?
Ich möchte keinen Hook haben, der mir immer Bescheid gibt, wenn die Taste gedrückt wird, sondern ich möchte zu einem bestimmten Zeitpunkt überprüfen, ob diese Tasten im Moment runtergedrückt ist.
Wie kann ich das machen? (wusste auch nicht wonach ich in der Suche suchen sollte.)
Vielen Dank im voraus

toms 4. Apr 2005 18:36

Re: Überprüfen ob STRG gedrückt ist
 
Delphi-Quellcode:
function CtrlDown: Boolean;
var
  State: TKeyboardState;
begin
  GetKeyboardState(State);
  Result := ((State[VK_CONTROL] and 128) <> 0);
end;

function ShiftDown: Boolean;
var
  State: TKeyboardState;
begin
  GetKeyboardState(State);
  Result := ((State[VK_SHIFT] and 128) <> 0);
end;

function AltDown: Boolean;
var
  State: TKeyboardState;
begin
  GetKeyboardState(State);
  Result := ((State[VK_MENU] and 128) <> 0);
end;
(by SDC)

Nicolai1234 4. Apr 2005 18:37

Re: Überprüfen ob STRG gedrückt ist
 
Vielen Dank. Genau danach hatte ich gesucht.

Wer ist SDC bzw. was ist deine Quelle? (falls ich sowas nochmal suche)

toms 4. Apr 2005 18:42

Re: Überprüfen ob STRG gedrückt ist
 
Zitat:

Zitat von Nicolai1605
Vielen Dank. Genau danach hatte ich gesucht.
Wer ist SDC bzw. was ist deine Quelle? (falls ich sowas nochmal suche)

Hier ist SDC: http://www.swissdelphicenter.ch/en/tipsindex.php


Alle Zeitangaben in WEZ +1. Es ist jetzt 05:22 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