Показать сообщение отдельно
Старый 14.03.2005, 21:27     # 4
CEO
Full Member
 
Аватар для CEO
 
Регистрация: 31.08.2003
Адрес: где-то между Марсом и Юпитером
Сообщения: 998

CEO Имеются все основания чтобы гордиться собойCEO Имеются все основания чтобы гордиться собойCEO Имеются все основания чтобы гордиться собойCEO Имеются все основания чтобы гордиться собойCEO Имеются все основания чтобы гордиться собойCEO Имеются все основания чтобы гордиться собойCEO Имеются все основания чтобы гордиться собойCEO Имеются все основания чтобы гордиться собойCEO Имеются все основания чтобы гордиться собойCEO Имеются все основания чтобы гордиться собойCEO Имеются все основания чтобы гордиться собой
На Паскале и под ДОС:
Цитата:
uses Dos;
const
JmpFar : record
OpCode : Byte;
BakInt9 : pointer;
end = (OpCode : $EA; BakInt9 : nil);
procedure MyInt9; far; assembler;
asm
push ax
in al,60h
cmp al,53h {клавиша Del}
jne @Exit
push ds
xor ax,ax
mov ds,ax
mov al,ds:[417h]
and al,0Ch
cmp al,0Ch {Ctrl+Alt ?}
jne @No
in al,61h
mov ah,al
or al,80h
out 61h,al
xchg ah,al
out 61h,al
mov al,20h
out 20h,al
pop ds
pop ax
iret
@No:
pop ds
@Exit:
pop ax
push seg JmpFar
push Offset JmpFar
end;
var
BakExitProc : pointer;
procedure ExitReboot; far; {выполняется пpи завеpшении}
begin
SetIntVec($9,JmpFar.BakInt9);{веpнуть обpаботчик клавиатуpы на pодину}
ExitProc:=BakExitProc;
end;
begin
BakExitProc:=ExitProc;
ExitProc:=@ExitReboot;
GetIntVec($9,JmpFar.BakInt9);{запомнить адpес обpаботчика клавиатуpы}
SetIntVec($9,@MyInt9);{установить свой обpаботчик клавиатуpы}
end.
На Паскале и под Windows:
Цитата:
unit LockSys;
interface
uses
Windows;

type TLockMode = (lmInput, lmSystemKeys, lmBoth);

function FuncAvail(_dllname, _funcname: string; var _p: pointer): boolean;
Function LockSystem(LockMode:TLockMode):Boolean;*
Function UnLockSystem(UnLockMode:TLockMode):Bool*ean;


var
xBlockInput : function(Block: BOOL): BOOL; stdcall;

implementation

function FuncAvail(_dllname, _funcname: string; var _p: pointer): boolean;
var _lib: tHandle;
begin
Result := false;
_p := NIL;
if LoadLibrary(PChar(_dllname)) = 0 then exit;
_lib := GetModuleHandle(PChar(_dllname));
if _lib <> 0 then
begin
_p := GetProcAddress(_lib, PChar(_funcname));
if _p <> NIL then Result := true;
end;
end;

Function LockSystem(LockMode:TLockMode):Boolean;*
begin
Result:=False;

IF LockMode = lmSystemKeys then //Locking system
IF not SystemParametersInfo(SPI_SCREENSAVERRUN*NING, 1, nil, 0) then Exit;

IF LockMode=lmInput then //locking keyb and mouse
if FuncAvail(''USER32.DLL'', ''BlockInput'', @xBlockInput) then xBlockInput(true)
else Exit;

If LockMode = lmBoth then
begin
IF not SystemParametersInfo(SPI_SCREENSAVERRUN*NING, 1, nil, 0) then Exit;
if FuncAvail(''USER32.DLL'', ''BlockInput'', @xBlockInput) then xBlockInput(true)
else Exit;
end;

Result := True;
end;

Function UnLockSystem(UnLockMode:TLockMode):Bool*ean;
begin
Result:=False;

IF UnLockMode = lmSystemKeys then //UnLocking system
IF not SystemParametersInfo(SPI_SCREENSAVERRUN*NING, 0, nil, 0) then Exit;

IF UnLockMode=lmInput then //unlocking keyb and mouse
if FuncAvail(''USER32.DLL'', ''BlockInput'', @xBlockInput) then xBlockInput(false)
else Exit;

IF UnLockMode=lmBoth then
begin
IF not SystemParametersInfo(SPI_SCREENSAVERRUN*NING, 0, nil, 0) then Exit;
if FuncAvail(''USER32.DLL'', ''BlockInput'', @xBlockInput) then xBlockInput(false)
else Exit;
end;

Result := True;
end;

end.
__________________
Старые игры раздают здесь

Последний раз редактировалось CEO; 14.03.2005 в 21:33.
CEO вне форума