......
private
procedure mymessage(var msg:tmsg;var handled:boolean);
......
implementation
{$R *.DFM}
procedure TForm1.mymessage(var msg:tmsg;var handled:boolean);
begin
if (msg.hwnd=xxx.handle) then //xxx为控件name
begin
if msg.message =wm_rbuttondown then
begin
PopupMenu1.Popup(Mouse.CursorPos.X, Mouse.CursorPos.Y);
Handled := True;
end
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
application.onmessage:=mymessage;
end