
调试时要注意在程序中控制开启鼠标或键盘,否则输入设备都被封锁了,只有关电源重启.
procedure TForm1.LockKeyAndCursor(Lock: boolean)
var
LockRect: TRect
begin
if Lock = True then
begin
LockRect := Rect(Form1.Left + bvLockCursor.Left,
Form1.Top + bvLockCursor.Top,
Form1.Left + bvLockCursor.Left + bvLockCursor.Width,
Form1.Top + bvLockCursor.Top + bvLockCursor.Height)
ClipCursor(@LockRect)
LockKey(True)
end
else
begin
FreeRect := Rect(0,0,Screen.Width,Screen.Height)
ClipCursor(@FreeRect)
LockKey(False)
end
end
procedure TForm1.LockKey(Lock: boolean)
var
temp: integer
begin
if Lock = True then
begin
asm
IN AL,21H
OR AL,02H
OUT 21H,AL
end
SystemParametersInfo(SPI_SCREENSAVERRUNNING, 1, @temp, 0)//封锁组合键Ctrl+Alt+Del
end
else
begin
asm
IN AL,21H
AND AL,0FDH
OUT 21H,AL
end
SystemParametersInfo(SPI_SCREENSAVERRUNNING, 0, @temp, 0)//解开组合键Ctrl+Alt+Del
end
end
(以上代码出自大富翁)
procedure TForm1.Button1Click(Sender: TObject)begin
WebBrowser1.Navigate(Edit1.Text)
end
procedure TForm1.Button2Click(Sender: TObject)
begin
WebBrowser1.Enabled:=False
end
给你一个函数,调用它就可以对系统进行锁定测试环境:WinXP SP3 function LockWindows: Booleantype
TLockWorkStation = function: Boolean
var
hUser32: HMODULE
LockWorkStation: TLockWorkStation
begin
Result := False
hUser32 := GetModuleHandle('USER32.DLL')
if hUser32 <>0 then
begin
@LockWorkStation := GetProcAddress(hUser32, 'LockWorkStation')
if @LockWorkStation <>nil then
begin
LockWorkStation
Result := True
end
end
end
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)