was ist neu ¦  programmier tips ¦  indy artikel ¦  intraweb artikel ¦  informationen ¦  links ¦  interviews
 sonstiges ¦  tutorials ¦  Add&Win Gewinnspiel

Tips (1541)

Dateien (137)
Datenbanken (90)
Drucken (35)
Grafik (114)
IDE (21)
Indy (5)
Internet / LAN (130)
IntraWeb (0)
Mathematik (76)
Multimedia (45)
Oberfläche (107)
Objekte/
ActiveX (51)

OpenTools API (3)
Sonstiges (126)
Strings (83)
System (266)
VCL (242)

Tips sortiert nach
Komponente


Tip suchen

Tip hinzufügen

Add&Win Gewinnspiel

Werbung

33 Visitors Online


 
...die beiden Enter Tasten unterscheiden?
Autor: Igor Siticov
Homepage: http://www.sicomponents.com
[ Tip ausdrucken ]  

Tip Bewertung (7):  
     


{
An application may find it useful to differentiate between
the user pressing the ENTER key on the standard keyboard
and the ENTER key on the numeric keypad. Either action
creates a WM_KEYDOWN message and a WM_KEYUP message with
wParam set to the virtual key code VK_RETURN. When the
application passes these messages to TranslateMessage, the
application receives a WM_CHAR message with wParam set to
the corresponding ASCII code 13.

To differentiate between the two ENTER keys, test bit 24 of
lParam sent with the three messages listed above. Bit 24 is
set to 1 if the key is an extended key; otherwise, bit 24
is set to 0 (zero).

Because the keys in the numeric keypad (along with the
function keys) are extended keys, pressing ENTER on the
numeric keypad results in bit 24 of lParam being set, while
pressing the ENTER key on  the standard keyboard results in
bit 24 clear.
}


{
 The following code sample demonstrates differentiating
 between these two ENTER keys:
}


procedure TForm1.WMKeyDown(var Message: TWMKeyDown);
begin
  inherited
;
  case Message.CharCode of
    
VK_RETURN: // ENTER pressed
      
if (Message.KeyData and $1000000 <> 0) then
        
// Test bit 24 of lParam
        
ShowMessage('ENTER on numeric keypad')
      else
        
ShowMessage('ENTER on Standard keyboard');
  end;
end;


 

Bewerten Sie diesen Tipp:

dürftig
ausgezeichnet


Copyright © by SwissDelphiCenter.ch
All trademarks are the sole property of their respective owners