用realaudio控件做的rm播放器,在运行时 点击鼠标右键有realaudio控件自带的右键菜单(50分)

  • 主题发起人 主题发起人 jjnb
  • 开始时间 开始时间
J

jjnb

Unregistered / Unconfirmed
GUEST, unregistred user!
用realaudio控件做的rm播放器,在运行时 点击鼠标右键有realaudio控件自带的右键菜单
有办法去掉它吗? 再想问要做播放rm的播放器,还有其他不用real公司的控件的办法吗?
 
不用real的控件不太好办。
右健菜单屏蔽可以截获程序右健消息,我屏蔽过Flash OCX的右健菜单
 
参考下面:
2. 处理RealPlayer控件的上下文菜单
其实RealPlayer 的“上下文菜单”不是真正意义上的上下文菜单,是一个右键点下菜单。仔细观察,会发现不同于其它控件的上下文菜单。
要想自定义该“上下文菜单”,对PupupMenu赋值,并在Application.OnMessage中进行处理:

unit Unit1;

interface

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

type
TForm1 = class(TForm)
RealAudio1: TRealAudio;
PopupMenu1: TPopupMenu;
aaaa1: TMenuItem;
aaaa2: TMenuItem;
procedure myproc(var Msg:TMsg;var Handled:boolean);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.myproc(var Msg: TMsg
var Handled: boolean);
var
x1,y1,x2,y2,x,y:integer;
b:Boolean;
p:TPoint;
begin
x1:=realAudio1.left;
y1:=realAudio1.top;
x2:=x1+realAudio1.Width;
y2:=y1+realAudio1.height;

p:=ScreenToClient(msg.pt);
x:=p.x;
y:=p.y;

b:=((x>=x1) and (x<=x2) and (y>=y1) and (y<=y2));
if (b) then
begin
if (msg.message=wm_Rbuttondown) then
handled:=true;
if (msg.message=wm_Rbuttonup) then
begin
if assigned(realAudio1.PopupMenu) then
TrackPopupMenu(realAudio1.PopupMenu.Handle,
TPM_LEFTALIGN,msg.pt.x,msg.pt.y,0,handle,nil);
handled:=true;
end;
end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
application.OnMessage :=myproc;
end;

end.
 
PopupMenu1怎么不能用呀?
 

Similar threads

D
回复
0
查看
2K
DelphiTeacher的专栏
D
D
回复
0
查看
1K
DelphiTeacher的专栏
D
D
回复
0
查看
1K
DelphiTeacher的专栏
D
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
后退
顶部