delphi中flash-Active控件右键屏蔽

    技术2022-05-11  129

    在delphi中使用了flash的Active控件后flash自带的右键菜单影响了我们的程序结果,其实这个右键可以被屏蔽.

    声明procedure ApplicationEvents1Message(var Msg: tagMSG; var Handled: Boolean);

    procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG; var Handled: Boolean); //Flash控件菜单begin  if ( Msg.message = WM_RBUTTONDOWN )      and      (        (windowfrompoint(Mouse.CursorPos)=ShockwaveFlash1.handle)           or        (windowfrompoint(Mouse.CursorPos)=form2.ShockwaveFlash1.handle)     )   then    begin      popupmenu1.Popup(Mouse.CursorPos.X, Mouse.CursorPos.Y);      Handled := True;    end;end;

    注意在form1.create (程序初始化中) 添加application.OnMessage:=ApplicationEvents1Message; 

    注:   1.其他的Active控件(如realplay的右键菜单)也可以通过这种方法进行屏蔽。   2.其实这里用到的是windows的消息机制,大家可以参考一下相关资料。


    最新回复(0)