Page 1 of 1

Unable to hide toolbar when ActiveX loads

Posted: 22 Nov 2016 14:26
by Sarrus
Hi,

I have vlc ActiveX control embedded in my own ActiveX control. I need to have toolbar always invisible.

This is my code:

Code: Select all

_vlcControl = new AxVLCPlugin2(); _vlcControl.BeginInit(); _vlcControl.Enabled = true; _vlcControl.Location = new Point(0, 0); _vlcControl.Name = VlcControlName; _vlcControl.Size = parentControl.Size; _vlcControl.TabIndex = 0; _vlcControl.MediaPlayerEndReached += (sender, args) => UpdateRtspStream(); _vlcControl.EndInit(); parentControl.Controls.Add(_vlcControl); _vlcControl.Toolbar = false; _vlcControl.FullscreenEnabled = false;
Toolbar is still visible when control shows up. When I take the mouse pointer away, toolbar hides itself after few seconds and doesn't show up again. What can I do to prevent it showing from the start?

Re: Unable to hide toolbar when ActiveX loads

Posted: 23 Nov 2016 21:11
by da2424
This sounds like that the property is set too late.
Could you try to set this setting earlier?

Re: Unable to hide toolbar when ActiveX loads

Posted: 24 Nov 2016 10:21
by Sarrus
If I set property before parentControl.Controls.Add(), then AxHost.InvalidActiveXStateException is thrown.

From MSDN:
The public properties and methods of an ActiveX control can only be referenced after the ActiveX control has been instantiated and initialized completely; otherwise the AxHost.InvalidActiveXStateException exception is thrown. The AxHost.InvalidActiveXStateException exception class contains the name of the member that made the reference and the member type. The member type is one of the AxHost.ActiveXInvokeKind enumerated values.
I can't modify properties before CreateControl is called (adding control to parent do this). I set them as soon as I could.

Re: Unable to hide toolbar when ActiveX loads

Posted: 09 Dec 2016 16:05
by da2424
In Visual Studio (tested with VB.NET and C#), you can set it with the object property window.

Re: Unable to hide toolbar when ActiveX loads

Posted: 11 Dec 2016 12:59
by sstbrg
Same question - can it be done in Matlab rather than visual studio?

Re: Unable to hide toolbar when ActiveX loads

Posted: 14 Dec 2016 11:05
by Sarrus
In Visual Studio (tested with VB.NET and C#), you can set it with the object property window.
As you can see in my first post, I creating control manually, not by designer.

Nevertheless I checked how designer sets this property. I had to use git, because this property is not set in *.Designer.cs. It turns out that it is set as binary value in resources. I don't know what that is (part of resx file):

Code: Select all

<data name="ocxState" mimetype="application/x-microsoft.net.object.binary.base64"> <value> AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACFTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5BeEhvc3QrU3RhdGUBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAgwEAAAIB AAAAAQAAAAAAAAAAAAAAAG4BAAAHAAAAKABDAG8AdQBuAHQAKQADAA0AAAAIAAAAQQB1AHQAbwBMAG8A bwBwAAsAAAAIAAAAQQB1AHQAbwBQAGwAYQB5AAsA//8JAAAAQgBhAGMAawBDAG8AbABvAHIAAwAAAAAA BwAAAEIAYQBzAGUAVQBSAEwACAAAAAAACAAAAEIAcgBhAG4AZABpAG4AZwALAAAADAAAAEUAeAB0AGUA bgB0AEgAZQBpAGcAaAB0AAMANSUAAAsAAABFAHgAdABlAG4AdABXAGkAZAB0AGgAAwCqQgAAEQAAAEYA dQBsAGwAcwBjAHIAZQBlAG4ARQBuAGEAYgBsAGUAZAALAAAAAwAAAE0AUgBMAAgAAAAAAAkAAABTAHQA YQByAHQAVABpAG0AZQADAAAAAAAHAAAAVABvAG8AbABiAGEAcgALAAAABwAAAFYAaQBzAGkAYgBsAGUA CwD//wYAAABWAG8AbAB1AG0AZQADADIAAAAL </value> </data>
Here is example how to manually create control:

Code: Select all

_axVlcPlugin2 = new AxVLCPlugin2(); _axVlcPlugin2.BeginInit(); tableLayoutPanel1.Controls.Add(_axVlcPlugin2, 0, 1); _axVlcPlugin2.Dock = DockStyle.Fill; _axVlcPlugin2.Enabled = true; _axVlcPlugin2.Location = new Point(3, 38); _axVlcPlugin2.Name = "axVLCPlugin2"; _axVlcPlugin2.OcxState = (AxHost.State) VlcResources.ocxState; _axVlcPlugin2.Size = new Size(645, 360); _axVlcPlugin2.TabIndex = 0; _axVlcPlugin2.MediaPlayerPlaying += OnPlaying; _axVlcPlugin2.MediaPlayerEncounteredError += OnError; _axVlcPlugin2.MediaPlayerEndReached += OnEndReached; _axVlcPlugin2.EndInit();
Now it works.

Re: Unable to hide toolbar when ActiveX loads

Posted: 16 Dec 2016 16:50
by da2424
I have looked again into the file *.Designer.vb, Visual Studio does the same:

Code: Select all

Me.AxVLCPlugin21.OcxState = CType(resources.GetObject("AxVLCPlugin21.OcxState"), System.Windows.Forms.AxHost.State)
Thanks for reporting the save location!

Re: Unable to hide toolbar when ActiveX loads

Posted: 28 Dec 2016 23:55
by Jean-Baptiste Kempf
Nice!