Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I disable popup menu in TShockwaveFlash

Workaround

How can I disable popup menu in TShockwaveFlash

by  imagenetics  Posted    (Edited  )
If you have imported a Shockwave Flash ActiveX into your C++Builder IDE, so that you can display Macromedia Flash movies in your applications, you probably think how to disable the "About Macromedia Flash" popup menu. The solution is to write a function which responds to a message sent to the application when right mouse button is clicked. Here's the code ([color green]green lines[/color] is what you have to write):

In "Unit 1.h":
Code:
[b]private:[/b]
  [color green][b]void __fastcall[/b] NoRightClick(TMsg &Message, [b]bool[/b] &Handled);[/color]
In "Unit 1.cpp":
Code:
[b]__fastcall[/b] TForm1::TForm1(TComponent* Owner) : TForm(Owner)
{
[color green]Application->OnMessage = NoRightClick;[/color]
}
//-----------------------------------------------------------------
[color green][b]void __fastcall[/b] TForm1::NoRightClick(TMsg &Msg, [b]bool[/b] &Handled)
{
[b]if[/b]((Msg.message == WM_RBUTTONDOWN) && (Msg.wParam  == MK_RBUTTON)){
 Handled = [b]true[/b];
}[b]else[/b]{
 Handled = [b]false[/b];
}
}[/color]
If you want to popup your own menu (for some reason Popup Menu property in TShockwaveFlash doesn't work), add a proper component to the project and modify the above function in "Unit 1.cpp" with the following lines:
Code:
[b]void __fastcall[/b] TForm1::NoRightClick(TMsg &Msg, [b]bool[/b] &Handled)
{
[b]if[/b]((Msg.message == WM_RBUTTONDOWN) && (Msg.wParam  == MK_RBUTTON)){
 Handled = [b]true[/b];
 [color green]POINT cursorPos;
 GetCursorPos(&cursorPos);
 PopupMenu1->Popup(cursorPos.x, cursorPos.y);[/color]
}[b]else[/b]{
 Handled = [b]false[/b];
}
}
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top