修改flash控件的右键菜单?(50分)

  • 主题发起人 主题发起人 softy
  • 开始时间 开始时间
S

softy

Unregistered / Unconfirmed
GUEST, unregistred user!
对flash控件,如何修改其右键菜单呢?比如,屏蔽,添加,等等操作?
 
自己搞一个没有任何项目的弹出菜单,然后将它指定给FLASH控件
 
怎么指定给flash控件啊?我是新人啊
 
不有个popmenu属性嘛
 
不行如要屏蔽只有拦截鼠标消息,请高手出招吧,
 
屏蔽Flash控件右击菜单
http://dapha.net/down/list.asp?id=1718
 
在Falsh的Activex控件上加PopuMenu不管用的,需要拦截右键消息,再让其显示出右键菜单。
建立PopuMenu1,不用和Falsh控件关联。程序中改。
......
private
procedure mymessage(var msg:tmsg;var handled:boolean);
......
implementation

{$R *.DFM}

//屏蔽Flash的右键,添加自己的右键快捷菜单
procedure TForm1.mymessage(var msg:tmsg;var handled:boolean);
begin
if (msg.hwnd=ShockwaveFlash1.handle) then
begin
if msg.message =wm_rbuttondown then
begin
PopupMenu1.Popup(Mouse.CursorPos.X, Mouse.CursorPos.Y);
Handled := True;
end
end;
end;

然后在Form.OnCreate中写
procedure TForm1.FormCreate(Sender: TObject);
begin
application.onmessage:=mymessage;
end
 
替换flash弹出菜单
lienzhu


摘 要:通过flash的handle有效替换flash弹出菜单
关键字:替换flash弹出菜单
类 别:系统控制


unit Unit1;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Menus, StdCtrls, OleCtrls, ShockwaveFlashObjects_TLB;

type
TForm1 = class(TForm)
PopupMenu1: TPopupMenu;
ShockwaveFlash1: TShockwaveFlash;
procedure FormCreate(Sender: TObject);
private
procedure ApplicationEvents1Message(var Msg: tagMSG
var Handled: Boolean);
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.DFM}
procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG
var Handled: Boolean);
begin
if (Msg.message = WM_RBUTTONDOWN) and (windowfrompoint(Mouse.CursorPos)=ShockwaveFlash1.handle) then
begin
popupmenu1.Popup(Mouse.CursorPos.X, Mouse.CursorPos.Y);
Handled := True;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
application.OnMessage:= form1.ApplicationEvents1Message;
end;

end.


 
在有Flash ActiveX控件的Form中加入 "Application Events" 组件,在其"OnMessage" Event
加入:

Procedure TfrmMain.AppEvents1Message( Var Msg : tagMSG

Var Handled : Boolean )

Begin
    If ( Msg.Message = WM_RBUTTONDOWN ) Then Handled := True

End


要加入你的PopupMenu? 这样解决:

Procedure TfrmMain.AppEvents1Message( Var Msg : tagMSG

Var Handled : Boolean )

Begin
    If ( Msg.Message = WM_RBUTTONDOWN ) Then Begin
        popupmnuFlash.Popup( Mouse.CursorPos.X, Mouse.CursorPos.Y )

        Handled := True

    End

End;
=============来自www.delphi300.com
 
补充:
在Delphi 4 无TApplicationEvents组件, 但可以重载ShockwaveFlashObjects_TLB.pas中的WndProc过程:

protected
  ...
  procedure WndProc(var Message:TMessage)
override

  ...

...
procedure TShockwaveFlash.WndProc(var Message:TMessage)

begin
    if not (csDesigning in ComponentState) then begin
if ( Message.Msg=WM_RBUTTONDOWN ) and ( Menu=False ) then begin
          // Don't show de popup menu
          Message.Result := 0

end else inherited WndProc(Message)

Exit

    end

    inherited WndProc(Message)

end

 
多人接受答案了。
 
怎么看到回贴啊,真晕
 
后退
顶部