Problem with ActiveX control
Hello Everybody, my English is not very good, but I will try to explain my problem.
I use Shickwave Flash Object in my project.
Because this control don't have any mouse events like OnMove etc, so I create MyControl and use inherit.
I want to change control's context menu on menu of my own. It's OK, control's contextmenu replaced with menu of my own, but MenuItems in Menu of my own don't clicking. On click on menuitems nothing happend. There is all sample: PublicClass Form1 #
PublicClass flash
Inherits AxShockwaveFlashObjects.AxShockwaveFlash PublicConst WM_RBUTTONDOWN = &H204 Dim pointAsNew Point ProtectedOverridesSub WndProc(ByRef mAs System.Windows.Forms.Message)
SelectCase m.Msg
Case WM_RBUTTONDOWN
point =Me.PointToClient(Cursor.Position)
Me.ContextMenu.Show(Me, point)
Return
EndSelect MyBase.WndProc(m) EndSub
EndClass
Inherits System.Windows.Forms.Form
MyBase.New()
InitializeComponent()
EndSub
ProtectedOverloadsOverridesSub Dispose(ByVal disposingAsBoolean)
If disposingThen
IfNot (componentsIsNothing)Then
components.Dispose()
EndIf
EndIf
MyBase.Dispose(disposing)
EndSub
FriendWithEvents AxShockwaveFlash1As flash
FriendWithEvents ContextMenu1As System.Windows.Forms.ContextMenu
FriendWithEvents MenuItem1As System.Windows.Forms.MenuItem
<System.Diagnostics.DebuggerStepThrough()>
PrivateSub InitializeComponent()Me.components =New System.ComponentModel.ContainerDim resourcesAs System.Resources.ResourceManager =New System.Resources.ResourceManager(GetType(Form1))
Me.AxShockwaveFlash1 =New Flash_Player.flash
Me.ContextMenu1 =New System.Windows.Forms.ContextMenu
Me.MenuItem1 =New System.Windows.Forms.MenuItem
CType(Me.AxShockwaveFlash1, System.ComponentModel.ISupportInitialize).BeginInit()Me.SuspendLayout()
'
'AxShockwaveFlash1
'
Me.AxShockwaveFlash1.ContextMenu =Me.ContextMenu1
Me.AxShockwaveFlash1.Enabled =True
Me.AxShockwaveFlash1.Location =New System.Drawing.Point(16, 8)
Me.AxShockwaveFlash1.Name = "AxShockwaveFlash1"
Me.AxShockwaveFlash1.OcxState =CType(resources.GetObject("AxShockwaveFlash1.OcxState"), System.Windows.Forms.AxHost.State)
Me.AxShockwaveFlash1.Size =New System.Drawing.Size(352, 256)
Me.AxShockwaveFlash1.TabIndex = 0
'
'ContextMenu1
'
Me.ContextMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem1})
'
'MenuItem1
'
Me.MenuItem1.Index = 0
Me.MenuItem1.Text = "Выход"
'
'Form1
'
Me.AutoScaleBaseSize =New System.Drawing.Size(5, 13)
Me.BackColor = System.Drawing.Color.GhostWhite
Me.ClientSize =New System.Drawing.Size(384, 358)
Me.Controls.Add(Me.AxShockwaveFlash1)
Me.ForeColor = System.Drawing.SystemColors.ControlText
Me.KeyPreview =True
Me.MinimumSize =New System.Drawing.Size(392, 392)
Me.Name = "Form1"
Me.Text = "Spawn Flash Player"
Me.TransparencyKey = System.Drawing.Color.Violet
CType(Me.AxShockwaveFlash1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
EndSub
#
EndRegionPrivateSub MenuItem1_Click(ByVal senderAs System.Object,ByVal eAs System.EventArgs)Handles MenuItem1.ClickEnd
EndSub
Public
Class flashInherits AxShockwaveFlashObjects.AxShockwaveFlash
PublicConst WM_RBUTTONDOWN = &H204
Dim pointAsNew Point
ProtectedOverridesSub WndProc(ByRef mAs System.Windows.Forms.Message)
SelectCase m.Msg
Case WM_RBUTTONDOWN
point =Me.PointToClient(Cursor.Position)
Me.ContextMenu.Show(Me, point)
Return
EndSelect
MyBase.WndProc(m)' Передаем события дальше
EndSub
EndClass
I hope that you understand something.

