Unit Unit1;

Interface

Uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls; Type
TForm1 = Class(TForm)
ReleaseScrollLockBtn: TButton;
SetScrollLockBtn: TButton;
Procedure SetScrollLockBtnClick(Sender: TObject);
Procedure ReleaseScrollLockBtnClick(Sender: TObject);
Private
{ Private declarations }
Public
{ Public declarations }
End; Var
Form1 : TForm1; Implementation {$R *.DFM} //----------------------------------------------------------------------
// The Numlock key can be pressed this way under NT but NOT under W95!
// The ScrollLock and CapsLock can be pressed this way under NT and W95
// as well.
// You can also simulate a PrintScreen (SnapShot).
// See the Delphi help file for soft-pressing this key.
// (Set the blinking cursor in the word: "keybd_event" and press: "F1")
//----------------------------------------------------------------------
Procedure SetNumLock(Bo : Boolean); Var
keyState : TKeyBoardState; Begin
GetKeyboardstate(keyState);
// keyState[VK_SCROLL] = 0 means the led is off
// keyState[VK_SCROLL] 0 means the led is on
If ( (Bo = True) and (keyState[VK_SCROLL] = ) ) or
( (Bo = False) and (keyState[VK_SCROLL] ) ) then
Begin
// Simulate a depress
keybd_event(VK_SCROLL,,KEYEVENTF_EXTENDEDKEY,);
// Simulate a release
keybd_event(VK_SCROLL,,KEYEVENTF_EXTENDEDKEY + KEYEVENTF_KEYUP,);
End;
End;
//----------------------------------------------------------------------
Procedure TForm1.SetScrollLockBtnClick(Sender: TObject); Begin
SetNumLock(TRUE);
End;
//----------------------------------------------------------------------
Procedure TForm1.ReleaseScrollLockBtnClick(Sender: TObject); Begin
SetNumLock(FALSE);
End;
//----------------------------------------------------------------------
End. {of Unit1}
//======================================================================

最新文章

  1. JSON金额解析BUG的解决过程
  2. Web3DGame之路(三)分析babylonjs
  3. Wix 安装部署(一)同MSBuild 自动生成打包文件
  4. java utf-8文件处理bom头
  5. 第十五章:Android 调用WebService(.net平台)
  6. uml中定义的关系详细详解
  7. curl get started
  8. 还在在专业的blog记录生活吧!
  9. 关于Tcp三次握手的思考
  10. [React] Styling a React button component with Radium
  11. USB OTG简要
  12. SSE图像算法优化系列十:简单的一个肤色检测算法的SSE优化。
  13. 防止html5的video标签在iphone中自动全屏
  14. EF架构~Dapper.Contrib不能将Linq翻译好发到数据库,所以请不要用它
  15. asp 获取url 返回值 和 对json 返回值的处理
  16. LoadRunner简单介绍----性能自动化测试工具
  17. LNMP平台部署
  18. linux log
  19. TCP加速锐速SS(ServerSpeeder)破解版一键安装
  20. kubernetes下安装mysql

热门文章

  1. Microsoft Dynamics CRM 2011 中 SQL 语句总结
  2. CentOS7 安装mysql(YUM方式)
  3. 胖子哥的大数据之路(6)- NoSQL生态圈全景介绍
  4. ALGO-2_蓝桥杯_算法训练_最大最小公倍数
  5. python学习笔记--smtp模块的使用及常见错误处理
  6. 微信小程序之for循环
  7. Spring IOC - 控制反转(依赖注入) - 创建对象的方式
  8. java.lang.Object类
  9. 长沙雅礼中学集训-------------------day1(内含day0)
  10. 学习MongoDB 五: MongoDB查询(数组、内嵌文档)(二)