Re:ALT & ALT-GR key
Quote
Dirk Kisch wrote:
> How can I fidn out, wether the ALT or the ALT-GR key is pressed?
> I can find out all other keys, but not this two.
ALT and ALT-GR belong to the special keys, that also contain SHIFT,
CAPS, .. . They cannot be checked by using readkey, you have to check
them on your own. Try this piece of code:
PROCEDURE GetSchiftState;
var schif : byte;
regs : registers;
BEGIN
regs.AH := 2;
Intr($16,Regs);
schift := Regs.AL;
if Schift AND 1 = 1 then Rsch :=true else Rsch := false;
if Schift AND 2 = 2 then Lsch :=true else Lsch := false;
if Schift AND 4 = 4 then Strg :=true else Strg := false;
if Schift AND 8 = 8 then Alt :=true else Alt := false;
if Schift AND 16 = 16 then scroll:=true else scroll:= false;
if Schift AND 32 = 32 then Num :=true else num := false;
if Schift AND 64 = 64 then caps :=true else caps := false;
if Schift AND 128 =128 then ins :=true else ins := false;
END;
{ Please do not complain about the structure of this code... It's pretty
old and I don't have the time to re-format it now... sorry! }
This will help you to check, whether one of these keys is pressed or
not. Unfortunatley, (with this method) you cannot decide whether ALT or
ALT-GR is pressed... To do this, you have to hook the keyboard int, but
this is a bit more complicated...
Hope, this helps at least a bit!
--
Arno Fehm (af...@bigfoot.de)
------------------------------------------------------------------------
Member of Grey Dreams Design: visit http://GreyDreams.home.pages.de !!!!
He who can destroy a thing has the real control over it. (Frank Herbert)
------------------------------------------------------------------------