Timers fighting with CommonDlg (VB6)

Started by Ryzer,

Ryzer

Hi,

I use timers in my Visual Basic project. Now when I use CommonDialog to open an "OPEN FILE" window to let the user select an MP3 to play in BASS, all the timers in my projects frees until I close the CommonDialog window  ???
This can be really annoying because it freeses my timers, VU meters, OSC's, etc.

Does anyone know how to fix this? (IE: use API calls instead of the CmDlg to open such windows, or code-based timers...?)

Thanks for your help,
Ryzer

Peter_Hebels

#1
I have made an API timer example for you, you can download the source here:
http://home.zonnet.nl/hebels13/apitimers.zip

And here is a API replacement for the CommonDialog control:
http://home.zonnet.nl/hebels13/cdfile.zip

I use the same code in my mp3 player and have no freeses when I open a Common Dialog this way.

Irrational86

#2
The problem is while in the VB IDE, if you make the EXE and run it, the problem doesnt happen...

Luckie

#3
The reason is very simple: The open files dialog is opend modal to your application. While the dialog is being displayed your app does not query its message queue. Therefor no WM_TIMER messages are dispatched to your WindowProcedure in your application's message loop. That's why everthing stopps.
Solution: Use threads for updating your visualizations and stuff.

I don't know VB very well, but I have heard that VB does not support multithreading applications. So if you want to stick to VB you have top live with it.

Well, XMinioNX just tells me I'm wrong. But as I said I'm not very familiar with VB.

Ryzer

So far I head VB does support multithreading.
btw thanks Peter_Hebels this helps me alot  :)

(: JOBnik! :)

#5
Hi ;D

You can use the API Multimedia Timer, but unfortunately it will crash your application in VB  :-/

Have fun!

8) JOBnik! 8)

autumn_water

Hello,
  There're no problem with APIs in VB , they're perfect ... ;)
  I think you should add APIs funcion into your vb source  ;D ...
Goodluck,
:)Autumn_water:)

(: JOBnik! :)

Hi ;D

There's not problems with simple API Timer, but there is a problem with API Multimedia Timers :P

Have fun!

8) JOBnik! 8)

big_gun

Get the CCRP Timer controls at http://www.mvps.org/ccrp/ it works like a charm, and msgboxs and common dialogs don't get in the way of timer processing.

Rick