锁键盘procedure TForm1.Button1Click(Sender: TObject);
begin
Asm //封锁20端口
IN AL,21H
OR AL,02H
OUT 21H,AL
end;
end;procedure TForm1.Button2Click(Sender: TObject);
begin
Asm //解锁20端口
IN AL,21H
AND AL,0FDH
OUT 21H,AL
end;
end;
begin
Asm //封锁20端口
IN AL,21H
OR AL,02H
OUT 21H,AL
end;
end;procedure TForm1.Button2Click(Sender: TObject);
begin
Asm //解锁20端口
IN AL,21H
AND AL,0FDH
OUT 21H,AL
end;
end;
解决方案 »
- oracle数据库导出到excel时中文出现乱码
- delphi 参数里的负1到底代表什么意思呀
- 在access数据库里怎样查找一个布尔值??即:select * from talbe1 where 是否迟到 = false.其中“是否迟到”为布尔值。
- TdxTreeList如何实现间隔色(奇数行一种颜色,偶数行一种颜色。)
- 数据插入的问题
- 请将下列的C++转化成Delphi
- 一个TEnhTreeView的问题
- 在生成SQLSEVER数据库别名的时候,怎样把数据库名、SEVERNAME、USERNAME保存到配置文件中?
- 高分求《Delphi 5.x 分布式多层应用电子商务篇》配书源码
- 如何让程序运行一次后将自己(.exe)的文件删除?
- Delphi 中如何编写控件?
- 怎样才能将WAV文件写入CD R/RW制作成CD
Library KillKB;Uses Wintypes, WinProcs
{$IFNDEF VER80}
,Win31
{$ENDIF}
;
Var
oldHook: HHook;Function KbHook( code: Integer; wparam: Word; lparam: LongInt ): LongInt;
export;
Begin
If code < 0 Then
KbHook := CallNextHookEx( oldHook, code, wparam, lparam )
Else
KbHook := 1;
End; { KbHook }Function DisableKeyboard: Boolean; export;
Begin oldHook := SetWindowsHookEx( WH_KEYBOARD, KbHook, HInstance, 0 );
DisableKeyboard := oldHook <> 0;
End;Procedure EnableKeyboard; export;
Begin
If oldHook <> 0 Then Begin
UnhookWindowshookEx( oldHook );
oldHook := 0;
End; { If }
End;exports
DisableKeyboard index 1,
EnableKeyboard index 2;Begin
oldHook := 0;
End.有一些组合键不能屏蔽掉,例如Ctrl+Alt+Del!
BlockInput(true);
BlockInput(False); ================================================================
一颗红心向前看,为了革命两茫然,不好意思才囊尽,只能说上一点点。
★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆
★ 我踢 我踢 我踢 我踢 我踢 我踢 我踢 我踢 我踢 ★
★ 你UP 你UP 你UP 你UP 你UP 你UP 你UP 你UP 你UP ★
★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆
================================================================
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
// 检测函数是否存在于系统库中(dll)
function FuncAvail (VLibraryname, VFunctionname: string; var VPointer: Point
er):
boolean;
var
Vlib: tHandle;
begin
Result := false;
VPointer := NIL;
if LoadLibrary(PChar(VLibraryname)) = 0 then
exit;
Vlib := GetModuleHandle(PChar(VLibraryname));
if Vlib <> 0 then
begin
VPointer := GetProcAddress(Vlib, PChar(VFunctionname));
if VPointer <> NIL then
Result := true;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
xBlockInput : function(Block: BOOL): BOOL; stdcall;
begin
if FuncAvail('USER32.DLL', 'BlockInput', @xBlockInput) then
begin
xBlockInput(true); // 锁死鼠标和键盘
Sleep(15000); // 等待 15 秒
xBlockInput(false); // 恢复
end;
end;
end.
KHK:=SetWindowsHookex(WH_JOURNALPLAYBACK,@HookProc,HInstance,0);//开始锁定
SystemParametersInfo(SPI_SCREENSAVERRUNNING, 1, @tmp, 0);//屏蔽Windows的系统键Ctrl-Alt-Tab,Ctrl-Esc,Alt-Tab等
end;