屏蔽FLASH中的菜单
用鼠标钩子实现屏蔽Flash控件 TShockwaveFlash 中的右键菜单
var
hHk: HHOOK;
function MouseHookProc(nCode: Integer; WParam: WParam; LParam: LParam)
: LRESULT; stdcall;
var
MouseHookStruct: ^TMOUSEHOOKSTRUCT;
begin
Result := 0;
if nCode < 0 then
Result := CallNextHookEx(hHk, nCode, WParam, LParam)
else if WParam = WM_RBUTTONDOWN then
begin
MouseHookStruct := Pointer(LParam);
if MouseHookStruct.hwnd = form1.ShockwaveFlash1.Handle then
Result := 1;
end;
end;
if hHk = 0 then
Begin
hHk := SetWindowsHookEx(WH_MOUSE, @MouseHookProc, Hinstance, 0);
end;
if hHk <> 0 then
begin
UnHookWindowsHookEx(hHk);
hHk := 0;
end;
也可以用下面的方法来实现 :
在 " Application Events " 的 " OnMessage Event " 添加以下代码即可 !
procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG;
var Handled: Boolean);
begin
if Msg.message = WM_RBUTTONDOWN then
Handled := True;
end;
If by chance you wanted to place your own popupmenu, then
do the following:
procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG;
var Handled: Boolean);
begin
if Msg.message = WM_RBUTTONDOWN then
begin
popupmenu1.Popup(Mouse.CursorPos.X, Mouse.CursorPos.Y);
Handled := True;
end;
end;