SystemParametersInfo在Windows NT下 已经失效了吧 测试不通过
试试用键盘钩子吧
library KeyHook;
uses
Windows,Messages;
var
MyHook: HHOOK;
function KeyHookProc(icode: integer;wparam:WPARAM; lparam: LPARAM):LRESULT;stdcall;
begin
Result:= 0;
if icode < 0 then
Result:= CallNextHookEx(MyHook,icode,wparam,lparam)
else
begin
if ((GetKeyState(VK_MENU) and $80) <> 0) and (wparam =VK_F4) then
Result:=1;
end;
end;
function InstallKeyHook:boolean;stdcall;
begin
MyHook:= 0;
MyHook:= SetWindowsHookEx(WH_KEYBOARD,@KeyHookProc,Hinstance,0);
Result:= (MyHook<>0);
end;
function UnInstallKeyHook:boolean;stdcall;
begin
Result:= False;
if MyHook <> 0 then
begin
UnHookWindowsHookEx(MyHook);
MyHook:=0;
end;
Result:= MyHook = 0;
SendMessage(HWND_BROADCAST,WM_SETTINGCHANGE,0,0);//广播消息
end;
exports
InstallKeyHook,UnInstallKeyHook;
begin
end.