关于控制CAPS LOCK按键
点击次数:49 次 发布日期:2008-11-09 08:37:46 作者:源代码网
|
源代码网推荐 源代码网推荐 const 源代码网推荐 SCROLLLOCK = 1; 源代码网推荐 NUMLOCK = 2; 源代码网推荐 CAPSLOCK = 4; 源代码网推荐 源代码网推荐 var 源代码网推荐 Status: Byte; 源代码网推荐 PntK: ^Byte; 源代码网推荐 begin 源代码网推荐 PntK := Ptr($40, $97); {directly point in 源代码网推荐 memory} 源代码网推荐 Status := Byte(PntK^); {read the status} 源代码网推荐 if (NUMLOCK and Status) = NUMLOCK then {if NUM 源代码网推荐 LOCK is on} 源代码网推荐 Status := Status and (255 - NUMLOCK) {turn it 源代码网推荐 off} 源代码网推荐 else 源代码网推荐 Status := Status or 2; {turn it 源代码网推荐 on} 源代码网推荐 Pntk^ := Status; {poke in 源代码网推荐 memory (don"t works)} 源代码网推荐 end; 源代码网推荐 源代码网推荐 A: 源代码网推荐 I use this procedures to turn on the caps lock if it isn"t 源代码网推荐 already on when 源代码网推荐 the user enters my DBloockup combo. This gets rid of the 源代码网推荐 nasty problem 源代码网推荐 of case-sensitive indexes. 源代码网推荐 源代码网推荐 procedure TMainForm.StudentLookupEnter(Sender: TObject); 源代码网推荐 Var Level : Integer; 源代码网推荐 KeyState : TKeyBoardState; 源代码网推荐 begin 源代码网推荐 {check if caps-lock is on - if not turn it on} 源代码网推荐 Level := GetKeyState(VK_CAPITAL); 源代码网推荐 GetKeyboardState(KeyState); 源代码网推荐 CapsLockStatus := KeyState; 源代码网推荐 If Level = 0 then 源代码网推荐 begin 源代码网推荐 KeyState[VK_CAPITAL] := 1; 源代码网推荐 setKeyboardState(KeyState); 源代码网推荐 end; 源代码网推荐 end; 软件开发网 www.mscto.com 源代码网推荐 源代码网供稿. |
