如何锁键盘或使建判无效??(100分)

H

heming

Unregistered / Unconfirmed
GUEST, unregistred user!
在程序运行时,如何锁键盘或使建判无效??退出时恢复!
 
转贴一编文章
function FunctionDetect (LibName, FuncName: String; var LibPointer: Pointer): boolean;
var LibHandle: tHandle;
begin Result := false;
LibPointer := NIL;
if LoadLibrary(PChar(LibName)) = 0 then exit;
LibHandle := GetModuleHandle(PChar(LibName));
if LibHandle <> 0 then
begin
LibPointer := GetProcAddress(LibHandle, PChar(FuncName));
if LibPointer <> NIL then Result := true;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var xBlockInput :
function (Block: BOOL): BOOL; stdcall;
begin
if FunctionDetect ('USER32.DLL', 'BlockInput', @xBlockInput) then
begin xBlockInput (True); // 禁止键盘鼠标
Sleep(10000); // 等待10秒
xBlockInput (False); // 允许键盘鼠标
end;
end
 
怎么连鼠标都锁住了,我只想要锁硬盘。该怎么做?
 
如果只想锁shift键呢?
 
用消息。呵。把所有键盘的消息全部截获掉。呵。
 
锁键盘

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;[:D]
 
nick4309,汇编的不懂.能解释一下你的程序吗?
如何禁止shift键
 
其实问题是我在使用WebBrowser做一个类似浏览器的小程序时候发现,
按着shift键鼠标点击连接回弹出新窗口。
我想禁止这种事情发生。如何做????
 
你是要锁所有程序都不能用键盘,还是只是你的程序,如果只是你的程序,那就太简单了。
只需要在Application中判断按钮信息就行了,如果是全部的程序,得考虑用HOOK了。
 
系统级锁定shift键
 
拦截Windows消息,想怎样都可以
 
winexec(Pchar('rundll32 keyboard,disable'),sw_Show);
winexec(Pchar('rundll32 keyboard,enable'),sw_Show);
 
to nick4309:
你的汇编和rundll32调用在w2k+dephi6中都报错
 
接受答案了.
 
顶部