Unable to hide toolbar when ActiveX loads

All you've ever wanted to know about the ActiveX, Mozilla plugins, the web interface and various PHP extensions
Sarrus
New Cone
New Cone
Posts: 3
Joined: 22 Nov 2016 14:14
Operating System: Windows
Location: Poznań, Poland

Unable to hide toolbar when ActiveX loads

Postby Sarrus » 22 Nov 2016 14:26

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?

da2424
Cone that earned his stripes
Cone that earned his stripes
Posts: 310
Joined: 16 Apr 2013 16:57

Re: Unable to hide toolbar when ActiveX loads

Postby da2424 » 23 Nov 2016 21:11

This sounds like that the property is set too late.
Could you try to set this setting earlier?

Sarrus
New Cone
New Cone
Posts: 3
Joined: 22 Nov 2016 14:14
Operating System: Windows
Location: Poznań, Poland

Re: Unable to hide toolbar when ActiveX loads

Postby Sarrus » 24 Nov 2016 10:21

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.

da2424
Cone that earned his stripes
Cone that earned his stripes
Posts: 310
Joined: 16 Apr 2013 16:57

Re: Unable to hide toolbar when ActiveX loads

Postby da2424 » 09 Dec 2016 16:05

In Visual Studio (tested with VB.NET and C#), you can set it with the object property window.

sstbrg
New Cone
New Cone
Posts: 3
Joined: 11 Dec 2016 12:55

Re: Unable to hide toolbar when ActiveX loads

Postby sstbrg » 11 Dec 2016 12:59

Same question - can it be done in Matlab rather than visual studio?

Sarrus
New Cone
New Cone
Posts: 3
Joined: 22 Nov 2016 14:14
Operating System: Windows
Location: Poznań, Poland

Re: Unable to hide toolbar when ActiveX loads

Postby Sarrus » 14 Dec 2016 11:05

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.

da2424
Cone that earned his stripes
Cone that earned his stripes
Posts: 310
Joined: 16 Apr 2013 16:57

Re: Unable to hide toolbar when ActiveX loads

Postby da2424 » 16 Dec 2016 16:50

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!

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Unable to hide toolbar when ActiveX loads

Postby Jean-Baptiste Kempf » 28 Dec 2016 23:55

Nice!
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.


Return to “Web and scripting”

Who is online

Users browsing this forum: No registered users and 15 guests