Program Held Up When Starting Stream

Started by ChrisM,

ChrisM

Hi Guys,

When I use the BASS DLL (in VB) to start an internet stream, the whole application freezes until the stream has connected. It's like when you use a Do...While loop and forget to put in "DoEvents" to allow other events (such as MouseDown) to be caught.

When BASS is connecting to a stream, does it have any form of "DoEvents" procedure that I can use? It would be nice to stop the application from freezing when BASS is trying to connect.

Any ideas would be greatfully received :)

Thanks in Advance,
Chris

Ian @ un4seen

The solution is to create a new thread, and create the stream in that. I can't help with creating threads in VB (don't use VB myself), but I guess it's possible :)

Irrational86

Ian, wouldnt it be better to just make an async StreamCreateURL?

ChrisM

Could anyone elaborate on those ideas?

Creating new threads... using an async StreamCreateURL procedure... all sounds like Greek to me... :-/

Any further help will be appreciated.

Chris

josl

Hi Chris,
First Question is: which VB Version?

For understanding your problem: The program fires no events for timers etc und accept no events mouse click etc during the net-buffering period of Bass? And you cannot even move the window? ;)

Joerg

ChrisM

Visual Basic 6.0 Enterprise Edition (SP5)

Yeah that's right, the window completely freezes, you can't even move it about. If you drag another window over it, it doesn't even re-paint.

Chris

josl

Hi Chris,
You need to make a Sub, which is running as a separate thread. In this sub you need to call Bass_StreamCreateURL – that's all. :)
And now the negative part in VB6:
You cannot easily call the CreateWin32Thread() API within your Program like in VB5. If you do this, it might work in the IDE, but compile it and it will crash!

On the following link, you might find a solution for that problem:
http://www.pscode.com/vb/scripts/ShowCode.asp?txtCodeId=26900&lngWId=1

If you need a rapid solution I would recommend a commercial OCX product, which can handle all the thread creation and termination.

Joerg

ChrisM

Thanks Joerg! :)

I will have a look at the URL you gave me and see what I can come up with.

Chris