No entiendo el sentido que le quieres dar a que el cursos del ratón no se mueva, eso te bloqueará las aplicaciones.
La forma mas sencilla de bloquear el ratón cuando detectas movimiento en mediante un Hook de bajo nivel rompiendo la cadena de hooks:
Código Delphi
[-]function MouseEvent(nCode, wParam, lParam: Integer): Integer; stdcall;
begin
if nCode>=0 then
begin
if wParam = WM_MOUSEMOVE then
begin
Result := -1;
exit;
end;
end;
Result:= CallNextHookEx(hMouseHook, nCode, wParam, lParam);
end;
El problema es que te quedas bloqueado si no colocas una bandera de desbloqueo. He preparado un ejemplo sencillo en el que el bloqeuo es controlado con un Timer. Pasado el tiempo prefijado se desbloquea el ratón:
Código Delphi
[-]unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls;
type
TForm1 = class(TForm)
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
public
end;
const
WH_MOUSE_LL = 14;
var
Form1: TForm1;
hMouseHook: HHOOK = 0;
tt: boolean = true;
implementation
{$R *.dfm}
function MouseEvent(nCode, wParam, lParam: Integer): Integer; stdcall;
begin
if nCode>=0 then
begin
if wParam = WM_MOUSEMOVE then
begin
Result := -1;
if tt then exit;
end;
end;
Result:= CallNextHookEx(hMouseHook, nCode, wParam, lParam);
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
tt:= false;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
hMouseHook:= SetWindowsHookEx(WH_MOUSE_LL, @MouseEvent, HInstance, 0);
end;
end.
Saludos.