Page 1 of 1

*SOLVED* Quitting a VB form while VLC Runs crashes Vista x64

Posted: 18 Feb 2009 21:31
by Hani123123
Hi there..
After i managed to integrate VLC in a Visual Basic 2008 form (thanks to revolunet), it seems that I managed to get stuck even worse.
Basically, I made a VB form, I added an axVLC, (AxVLCPlugin21) and a button.
The code for the button:

Code: Select all

Dim webAddress As String = "http://86.55.3.4:8000" AxVLCPlugin21.playlist.items.clear() AxVLCPlugin21.playlist.add(webAddress) AxVLCPlugin21.playlist.play()
After I hit the button, the player loads great, the streaming is flawless, but as soon as I hit the "Close" button

Code: Select all

Me.Close()
Vista throws a bluescreen and starts dumping memory. :shock:

If for example I open my form and I don't load any stream, the form closes properly via the "Close" button.
Please tell me what am I doing wrong? And please be gentle, as I am a total absolute beginner.

Thanks once again !

Re: Quitting a VB form while VLC Runs crashes Vista x64 Ultimate

Posted: 19 Feb 2009 13:49
by Hani123123
Anyone? Please? This got my project to a grinding halt... I am desperate, and the only way to avoid bluescreen is by killing it via TaskManager..

Re: Quitting a VB form while VLC Runs crashes Vista x64 Ultimate

Posted: 19 Feb 2009 13:51
by revolunet
before closing the form, use something like :

dim itemid as integer = AxVLCPlugin21.playlist.add("vlc://quit");
AxVLCPlugin21.playlist.playItem(itemid)

it should unload VLC, and then you can close your app

Re: Quitting a VB form while VLC Runs crashes Vista x64 Ultimate

Posted: 19 Feb 2009 14:22
by Hani123123
Thank you revolunet for your suggestion.
I have written the exact code line you told me. (except for the ";").

Same thing happens.

The Vista bluescreen indicates

STOP 0x0000003B SYSTEM_SERVICE_EXCEPTION
on win32k.sys

This happens only while using axvlc. If i insert a shockwave object, the form closes properly. What else should I try? :cry:
I also removed Me.Close from the line. And only running the vlc quit command does the same thing...

Re: Quitting a VB form while VLC Runs crashes Vista x64 Ultimate

Posted: 19 Feb 2009 14:58
by revolunet
did you try also stop the playback before closing ?

vlc.playlist.stop()

check before closing that everything about VLC is stopped.

Re: Quitting a VB form while VLC Runs crashes Vista x64 Ultimate

Posted: 19 Feb 2009 21:37
by Hani123123
revolunet, the playlist.stop command didn't work either.. so I think I found a resolutoin:

I added a dialog box on the "EXIT" button of the application (the one that originally included the Me.Close command).
The code is:

Code: Select all

AxVLCPlugin21.playlist.items.clear() AxVLCPlugin21.playlist.add("vlc://quit") AxVLCPlugin21.playlist.play() Dialog1.Show()
So basically, when the user wants to exit the application while the Confirmation dialog pops up, the VLC Plugin seems to have enough time to teminate properly.
So when the user confirms he wants to exit the application, VLC is already closed by then. I still don't know why all this hussle... but hey, a confirmation dialog is not too bad, as I was eventually needed..

Thank you again for your support, and I wish you hundred of flawless code lines! :lol:
Hani - Romania

Re: Quitting a VB form while VLC Runs crashes Vista x64 Ultimate

Posted: 20 Feb 2009 10:10
by revolunet
Hani,

be careful, the items.clear() doesnt seem to work for me on 0.9.6

thats why i use

Code: Select all

Dim itemid as integer = AxVLCPlugin21.playlist.add("vlc://quit") AxVLCPlugin21.playlist.playItem(itemid)
good luck

Re: Quitting a VB form while VLC Runs crashes Vista x64 Ultimate

Posted: 20 Feb 2009 16:00
by Hani123123
No luck mate. It seems that the workaround I tried fails, and the VLC plugin simply won't stop running.
I am thinking to kill the process when clicking OK in the dialog Box. I'll let you know how it goes.And yes, playlist.clear() doesn't seem to work for me either...

Re: Quitting a VB form while VLC Runs crashes Vista x64 Ultimate

Posted: 23 Feb 2009 20:35
by chad27295
Just to note I'm having the exact same error on 2 very different PCs one with Vista 32 and the other is Vista 64.

Re: Quitting a VB form while VLC Runs crashes Vista x64 Ultimate

Posted: 24 Feb 2009 16:06
by chad27295

Code: Select all

'Add a Timer to the form with an interval of 1000 or more and make sure its not enabled. Public Class Form1 Dim timercount = 0 Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click AxVLCPlugin21.playlist.add("udp://@239.255.1.15:5500") AxVLCPlugin21.playlist.play() End Sub Private Sub MyForm_Closing(ByVal sender As System.Object, ByVal e As _ System.ComponentModel.CancelEventArgs) Handles MyBase.Closing Try e.Cancel = True ' This will cancel the form from closing for now AxVLCPlugin21.playlist.items.clear() AxVLCPlugin21.playlist.add("vlc://quit") AxVLCPlugin21.playlist.play() Timer1.Enabled = True ' The timer will allow some seconds to pass and give the plugin time to quit. 1 second seems to work for me. Catch ee As Exception MsgBox("Can't close") 'Just in case something goes wrong. So far it hasn't failed End Try End Sub Private Sub Timer1_Tick_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick ' AxVLCPlugin21.Dispose() ' We could go further and remove the plugin alltogether but so far I don't think we need to Me.Dispose() ' If we just did a regular me.close here it would loop back to the form closing function and we wouldn't get anywhere. End Sub End Class
I was able to put a timer on my project to give the plugin time to quit before I closed the form. Thanks everyone for pointing me to the right direction on getting the plugin closed down first. I posted my complete code for everyone else that is still having a problem. Hopefully it will work for everyone.

Re: Quitting a VB form while VLC Runs crashes Vista x64 Ultimate

Posted: 25 Feb 2009 14:36
by Hani123123
Thank you very much chad27295 for sharing your timer code with us.
I took a different approach, tough. I disabled the controls of the form (so no Alt+F4, or X on the upper right is available anymore), and added a kill process function, so that it instantly kills the VB application, as soon as you hit the Close button.. Therefore, Me.Close() not needed anymore.
It's pretty rough and reckless, but works just perfectly! :)

If anyone needs the code, please let me know!!

Re: *SOLVED* Quitting a VB form while VLC Runs crashes Vista x64

Posted: 16 Mar 2009 10:39
by Ali_2009
@hani

me were making a project related to wireless communications:

Server (192.168.32.175) - will broadcast onboard cam's video stream through regular distributed VLC Software 0.9.6
CLIENT (192.168.32.75) will have VB VLC stream player like one which u developed + few added functionalities
CLIENT (192.168.32.76) will have VB VLC stream player like one which u developed + few added functionalities
CLIENT (192.168.32.77) will have VB VLC stream player like one which u developed + few added functionalities

plz mail me the VB 2008 - VLC Project you made at address:
ali.magsi@live.com

have to integrate axtiveX controls in an app connected to this VLC Client
earliest reply highly appreciated.
Thx