How to use contextmenu in shockwave
- Hi guys,
I have a shockwave on a form in my VB.NET application. Everything works great. Although, when a user right-clicks over the flash movie a flash context menu is displayed. How do I use the form contextmenu on flash??
Thanks,
Mark
Answers
- HI
Shockwave has put restrictions on its object context menu.
i found following code some where on web i didn't remember the link but it works fine.
you have to then declarePublic Class MyFlashControl Inherits AxShockwaveFlashObjects.AxShockwaveFlash Private Const WM_RBUTTONDOWN As Integer = &H204 Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message) Try Select Case m.Msg Case WM_RBUTTONDOWN ' HERE YOU CAN DO CODE TO DISPLAY CONTEXT MENU m.Result = New IntPtr(1) Return End Select Catch ex As Exception MsgBox(ex.Message) Exit Sub End Try MyBase.WndProc(m) End Sub End Class
dim withevents flsh1 as MyFlashControl.AxshockwaveFlash- Proposed As Answer byCor LigthertMVPFriday, October 30, 2009 4:52 PM
- Marked As Answer byMartin Xie - MSFTMSFT, ModeratorThursday, November 05, 2009 8:37 AM
- Marked As Answer byMark103 Tuesday, November 10, 2009 12:12 AM
- Unmarked As Answer byMark103 Saturday, November 07, 2009 10:00 PM
All Replies
- HI
Shockwave has put restrictions on its object context menu.
i found following code some where on web i didn't remember the link but it works fine.
you have to then declarePublic Class MyFlashControl Inherits AxShockwaveFlashObjects.AxShockwaveFlash Private Const WM_RBUTTONDOWN As Integer = &H204 Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message) Try Select Case m.Msg Case WM_RBUTTONDOWN ' HERE YOU CAN DO CODE TO DISPLAY CONTEXT MENU m.Result = New IntPtr(1) Return End Select Catch ex As Exception MsgBox(ex.Message) Exit Sub End Try MyBase.WndProc(m) End Sub End Class
dim withevents flsh1 as MyFlashControl.AxshockwaveFlash- Proposed As Answer byCor LigthertMVPFriday, October 30, 2009 4:52 PM
- Marked As Answer byMartin Xie - MSFTMSFT, ModeratorThursday, November 05, 2009 8:37 AM
- Marked As Answer byMark103 Tuesday, November 10, 2009 12:12 AM
- Unmarked As Answer byMark103 Saturday, November 07, 2009 10:00 PM
- Hi
Thanks for posting the source code, I have input the contextmenu code with the property to get the menu and I tried to use them on shockwave by clicking on right mouse button but it only shows flash menu.
Private Const WM_RBUTTONDOWN As Integer = &H204
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
Try
Select Case m.Msg
Case WM_RBUTTONDOWN
ContextMenuStrip1.GetContextMenu()
m.Result = New IntPtr(1)
Return
End Select
Catch ex As Exception
MsgBox(ex.Message)
Exit Sub
End Try
MyBase.WndProc(m)
End Sub
How do I display the contextmenu when I click rightmouse button on shockwave??
Thanks,
Mark - Mark,
Can you reread your reply and try to imagen why I don't understand it?
Success
Cor - Don't understand what I have asked?? I cannot open contextmenu when I clicked with right mouse button on shockwave. Now you got it??
How can I open contextmenu when I click with right mouse button??
Thanks,
Mark Don't understand what I have asked?? I cannot open contextmenu when I clicked with right mouse button on shockwave. Now you got it??
How can I open contextmenu when I click with right mouse button??
Thanks,
Mark
What's next Mark? Calling someone stupid again?How can I open contextmenu when I click with right mouse button??
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message) Try Select Case m.Msg Case WM_RBUTTONDOWN ' HERE YOU CAN DO CODE TO DISPLAY CONTEXT MENU Form1.ContextMenuStrip1.Show() ' Form1 = your Form ' Also you can set x,y of contextmenu with GetItemAt(x,y) m.Result = New IntPtr(1) Return End Select Catch ex As Exception MsgBox(ex.Message) Exit Sub End Try MyBase.WndProc(m) End Sub
Be Polite everyone is to helpHi
shockwave by clicking on right mouse button but it only shows flash menu.
What do you call that a unemtxetnoc or something?
Success
Cor- mark103 , no matter how frustrated most of us get sometimes w/some replies while coding, especially when you are the one asking questions, keep your cool .. always remember that .. we are only here as volunteers, not that we have to, same goes with providing suggestions/solutions, just volunteering to do so...
--------
about your question..
i'm a noob personally, so my suggestion might be noobish to most, but this should solve your problem with simple code..
try w/a new project.. add a panel, then place the shockwave control inside the panel .. enable the panel to false from panel properties . this should allow your flash to play, while blocking the flash contextmenu ..
then add your contextmenu to the form and the following code.
--Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown Dim panelx As Integer = Panel1.Location.X Dim panely As Integer = Panel1.Location.Y Dim panelw As Integer = Panel1.Width Dim panelh As Integer = Panel1.Height If e.Button = Windows.Forms.MouseButtons.Right Then If e.Location.X >= panelx And e.Location.X <= panelw And e.Location.Y >= panely _ And e.Location.Y <= panelh Then Me.Text = "yay! ;o)" Me.ContextMenuStrip1.Show(Me, e.X, e.Y) Else Me.Text = "nope.." End If End If End Sub
i hope to hear a "YAY!" from you..
if you have any further questions, do ask...
•.˙ trujade ˙.•- Proposed As Answer byShariqDON Friday, October 30, 2009 9:46 PM
- Edited by•.trujade.• Saturday, October 31, 2009 12:20 AM
- Marked As Answer byMartin Xie - MSFTMSFT, ModeratorThursday, November 05, 2009 8:37 AM
- Unmarked As Answer byMark103 Saturday, November 07, 2009 10:08 PM
- Thanks for the help D. A. Vyas, when I clicked right mouse button on shockwave, it still showing flash menu which it still not showing contextmenu.
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
Try
Select Case m.Msg
Case WM_RBUTTONDOWN
' HERE YOU CAN DO CODE TO DISPLAY CONTEXT MENU
Me.ContextMenuStrip1.Show()
m.Result = New IntPtr(1)
Return
End Select
Catch ex As Exception
MsgBox(ex.Message)
Exit Sub
End Try
MyBase.WndProc(m)
End Sub
Please help me to fix this.
Thanks,
Mark - @Trujade ->
You do have a way of maintaining the sanity around here.
If nobody else says it, allow me to say "thank you".
:)
.. ( sighs ) frank l. smith , thanx..
now, why don't you go stick a finger in your ______, and tell me if it is warm or not.
...
.. someone else told me theirs was freezing.
...
.. well, how is yours? do let me know.
..
...
( p.s. that underline is for coffee .
)
•.˙trujade˙.•
.. ( sighs ) frank l. smith , thanx..
now, why don't you go stick a finger in your ______, and tell me if it is warm or not.
...
.. someone else told me theirs was freezing.
...
.. well, how is yours? do let me know.
..
...
( p.s. that underline is for coffee .
)
•.˙trujade˙.•
... I meant it as a compliment. Sorry if it was misunderstood.
<--- that look is for being awwed by what you mentioned frank.. it was well appreciated. thanx again.
i did take it as a compliment, almost cried, so i just wanted to thank you back w/ some more of my sanity...
i hope it wasn't offensive, but a giggle, if any. thanx again.
•.˙trujade˙.•
<--- that look is for being awwed by what you mentioned frank.. it was well appreciated. thanx again.
i did take it as a compliment, almost cried, so i just wanted to thank you back w/ some more of my sanity...
i hope it wasn't offensive, but a giggle, if any. thanx again.
•.˙trujade˙.•
:)- Please help me how to use contextmenu on shockwave??
Thanks,
Mark - did my suggestion work?
worked for my sample project..
•.˙trujade˙.• - Yes it does work but I need the source code for shockwave. Please read my post carefully what I have looking for.
Thanks,
Mark .......Although, when a user right-clicks over the flash movie a flash context menu is displayed. How do I use the form contextmenu on flash??
this post? your original post?
Thanks,
Mark
first sentence, easy.. if you want to use the options on the shockwave, just right click and select your option! you already have your provided contextmenu..
second sentence, how do you use the form contextmenu?
i provided a reasonable solution, since forms do not have contextmenus, you have to add them to the forms, therefore, a form's contextmenu.
-------
Hi
you have the shockwave flash menu and you have your vb contextmenu..
Thanks for posting the source code, I have input the contextmenu code with the property to get the menu and I tried to use them on shockwave by clicking on right mouse button but it only shows flash menu.
'-- code, etc.
How do I display the contextmenu when I click rightmouse button on shockwave??
Thanks,
Mark
is there another menu that nobody knows about, except you, since my provided solution does not work. ???? do reply, i would like to know..
----
do not take my above as trying to be smart.. i just wish that you would think a little more about your question, before asking, and be as specific as possible..
•.˙trujade˙.•Yes it does work but I need the source code for shockwave. Please read my post carefully what I have looking for.
Thanks,
Mark
Than send a message to Adobe and ask what the price is for that, some persons are able to pay those prices, however be aware it will be something more than a Big Mac.
But I don't know how old you are and maybe you don't understand what we are asking to you.
A context menu is related to the control it is on, when you are on Windows Explorer, you get the context menu from a listview, when you are on Internet Explorer you get the context menu from that, so when you are on a flash control (the part that shows the movie), you get the contextmenu from that control.
And you have told us endless times that you get that Flash Context menu and therefore we don't understand what you want.
Success
CorI need the source code for shockwave.
using given idia you can completely disable the right-click message for that control.
To do this you need to inherit the Flash control to Change it with your message (here your message is your context menu).
you can do this as follows.
Create a project By Default it will be WindowsApplication1Add new Class and name it FlashWithCustomMenu.vb
1)Paste the following Code into it
2) Now, Open Form1.vb and paste the following code into itPublic Class FlashWithCustomMenu Inherits AxShockwaveFlashObjects.AxShockwaveFlash Private Const WM_RBUTTONDOWN As Integer = &H204 Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message) Try Select Case m.Msg Case WM_RBUTTONDOWN Form1.ShowContextMenu() m.Result = New IntPtr(1) Return End Select Catch ex As Exception MsgBox(ex.Message) Exit Sub End Try MyBase.WndProc(m) End Sub End Class
Public Class Form1 Friend WithEvents AxshockwaveFlash1 As FlashWithCustomMenu = New FlashWithCustomMenu() Friend WithEvents ContextMenuStrip1 As System.Windows.Forms.ContextMenuStrip = New ContextMenuStrip Friend WithEvents PlayToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem = New ToolStripMenuItem Friend WithEvents StopToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem = New ToolStripMenuItem Friend WithEvents ForwardToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem = New ToolStripMenuItem Friend WithEvents ReverseToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem = New ToolStripMenuItem Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.Controls.Add(AxshockwaveFlash1) ' 'AxShockwaveFlash1 ' Me.AxshockwaveFlash1.Enabled = True Me.AxshockwaveFlash1.Location = New System.Drawing.Point(0, 0) Me.AxshockwaveFlash1.Name = "AxShockwaveFlash1" Me.AxshockwaveFlash1.OcxState = CType(My.Resources.ResourceManager.GetObject("AxShockwaveFlash1.OcxState"), System.Windows.Forms.AxHost.State) Me.AxshockwaveFlash1.Size = New System.Drawing.Size(632, 435) Me.AxshockwaveFlash1.TabIndex = 0 Me.AxshockwaveFlash1.Movie = "C:\Documents and Settings\dami.ELEARNING\Desktop\For Hiren\video01[1].swf" ' 'ContextMenuStrip1 ' Me.ContextMenuStrip1.BackgroundImage = CType(My.Resources.ResourceManager.GetObject("ContextMenuStrip1.BackgroundImage"), System.Drawing.Image) Me.ContextMenuStrip1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch Me.ContextMenuStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.PlayToolStripMenuItem, Me.StopToolStripMenuItem, Me.ForwardToolStripMenuItem, Me.ReverseToolStripMenuItem}) Me.ContextMenuStrip1.Name = "ContextMenuStrip1" Me.ContextMenuStrip1.Size = New System.Drawing.Size(153, 114) ' 'PlayToolStripMenuItem ' Me.PlayToolStripMenuItem.Name = "PlayToolStripMenuItem" Me.PlayToolStripMenuItem.Size = New System.Drawing.Size(152, 22) Me.PlayToolStripMenuItem.Text = "Play" ' 'StopToolStripMenuItem ' Me.StopToolStripMenuItem.Name = "StopToolStripMenuItem" Me.StopToolStripMenuItem.Size = New System.Drawing.Size(152, 22) Me.StopToolStripMenuItem.Text = "Stop" ' 'ForwardToolStripMenuItem ' Me.ForwardToolStripMenuItem.Name = "ForwardToolStripMenuItem" Me.ForwardToolStripMenuItem.Size = New System.Drawing.Size(152, 22) Me.ForwardToolStripMenuItem.Text = "Forward" ' 'ReverseToolStripMenuItem ' Me.ReverseToolStripMenuItem.Name = "ReverseToolStripMenuItem" Me.ReverseToolStripMenuItem.Size = New System.Drawing.Size(152, 22) Me.ReverseToolStripMenuItem.Text = "Reverse" ' End Sub Public Sub ShowContextMenu() 'ContextMenuStrip1.Show(AxShockwaveFlash1.Height / 2, AxShockwaveFlash1.Width / 2) Dim Pos As Point = Me.PointToClient(MousePosition) ContextMenuStrip1.Show(Pos.X, Pos.Y) End Sub End Class
Then hit F5 to test. it will popup your created menu when you right click on control (play,stop,forward,reverse)- Thanks, but I am afraid that it still don't work. Please can you post sample project included with zip??
It would be much appreciate.
Thanks,
Mark Thanks, but I am afraid that it still don't work. Please can you post sample project included with zip??
It would be much appreciate.
Thanks,
Mark
Did you read my reply?
Cor- Yes! It still don't work....
Yes! It still don't work....
I know you always insulting people for not provides exact code for you, im posting this so that you can read the original thread where D.A.Vyas get the code from, may be you will understand the code better on your own. Sooner or later, you will end up insulting him like you did to me in your other previous flash related issue. if this does not work for you, dont blame anyone but yourself. So i dont want this to happen to anyone again. Below is the link to original thread. Good luck
how to disable AxShockwaveFlash menu
kaymaf
If that what you want, take it. If not, ignored it and no complain- I am not insulting, it didn't work for me so how can I be annoying when it still didn't work. Maybe I have done something wrong?? Have you tested yourself and did it works??
Thanks,
Mark I am not insulting, it didn't work for me so how can I be annoying when it still didn't work. Maybe I have done something wrong?? Have you tested yourself and did it works??
Thanks,
Mark
I don't have to test it, because it works for everyone that use the code except you. If you want to know if the code works, go to the link i posted above and read the comments from others that use the code.kaymaf
If that what you want, take it. If not, ignored it and no complain- Thanks for the help, the code is now working to open contextmenu on shockwave (the one who is not on the form on code). How can I use the code to work with the shockwave that I have already drag them on my form??
Thanks,
Mark - I think you should spend a few hours or days doing trial and error code to get it to work . Always asking for code is a lazy way to learn . If you have something working then figure out how to apply it to your other code .
coding for fun Be a good forum member mark posts that contain the answers to your questions or those that are helpful
Please format the code in your posts with the
button . Makes it easier to read .


