屏蔽右键菜单
var
Form1: TForm1;
FMHook: HHOOK;
function FMHookProc(Code: Integer; WParam: Longint; var Msg: TMsg): Longint; stdcall;
implementation
{$R *.DFM}
function FMHookProc(Code: Integer; WParam: Longint; var Msg: TMsg): Longint; stdcall;
begin
if Msg.Message = WM_RBUTTONDOWN then
with form1 do
begin
//你还可以先判断一下位置。
Msg.Message := 0;
end ;
Result := CallNextHookEx(FMHook, Code, WParam, Longint(@Msg)); //放出消息给下一个.
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
FMHook := SetWindowsHookEx(WH_GETMESSAGE, @FMHookProc, 0, GetCurrentThreadID);
end;