Author Topic: Timers fighting with CommonDlg (VB6)  (Read 16419 times)

Ryzer

  • Posts: 73
Timers fighting with CommonDlg (VB6)
« on: 19 Aug '03 - 23:16 »
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

  • Posts: 119
Re: Timers fighting with CommonDlg (VB6)
« Reply #1 on: 19 Aug '03 - 23:52 »
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.
« Last Edit: 19 Aug '03 - 23:59 by Peter_Hebels »

Irrational86

  • Posts: 960
Re: Timers fighting with CommonDlg (VB6)
« Reply #2 on: 20 Aug '03 - 01:44 »
The problem is while in the VB IDE, if you make the EXE and run it, the problem doesnt happen...
« Last Edit: 20 Aug '03 - 01:45 by XMinioNX »

Luckie

  • Posts: 16
Re: Timers fighting with CommonDlg (VB6)
« Reply #3 on: 21 Aug '03 - 06:09 »
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.
« Last Edit: 21 Aug '03 - 06:13 by Luckie »

Ryzer

  • Posts: 73
Re: Timers fighting with CommonDlg (VB6)
« Reply #4 on: 21 Aug '03 - 12:44 »
So far I head VB does support multithreading.
btw thanks Peter_Hebels this helps me alot  :)

(: JOBnik! :)

  • Posts: 1080
Re: Timers fighting with CommonDlg (VB6)
« Reply #5 on: 21 Aug '03 - 13:52 »
Hi ;D

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

Have fun!

8) JOBnik! 8)
« Last Edit: 21 Aug '03 - 13:53 by JOBnik »

autumn_water

  • Posts: 6
Re: Timers fighting with CommonDlg (VB6)
« Reply #6 on: 24 Aug '03 - 14:08 »
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! :)

  • Posts: 1080
Re: Timers fighting with CommonDlg (VB6)
« Reply #7 on: 24 Aug '03 - 16:28 »
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

  • Posts: 353
Re: Timers fighting with CommonDlg (VB6)
« Reply #8 on: 25 Aug '03 - 20:03 »
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

Ryzer

  • Posts: 73
Re: Timers fighting with CommonDlg (VB6)
« Reply #9 on: 7 Sep '03 - 11:58 »
big_gun thanks I will look at that :)