Solved

Timer does not fire during Send operation?

Posted on 2006-10-28
6
221 Views
Last Modified: 2010-04-30
I have a timer that fires every 1/10 of a second and updates a label on a form. It works fine, but when the following code is executed:

    Dim oHTTP As New MSXML2.XMLHTTP
    ...
    oHTTP.send (DataToSend)

my VB6 program "looses program control" to the "send" operation for about 15 seconds. In other words, my timer event does not fire during the "send" operation. Is there any way to cause my timer to continue to fire at its interval during the "send" operation?
0
Comment
Question by:lee88
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 28

Expert Comment

by:Ark
ID: 17827135
This is IDE behavior. Just compile your app and everything will be OK. Or use SetTimer API
0
 
LVL 32

Expert Comment

by:DrDamnit
ID: 17827158
Hi lee88,

You could also use DoEvents with the CCRP timer:

http://ccrp.mvps.org/index.html?controls/ccrptimer6.htm


Cheers!
0
 

Author Comment

by:lee88
ID: 17827211
Ark: I compiled, but no change. I will try SetTimer API.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 28

Accepted Solution

by:
Ark earned 500 total points
ID: 17827276
Here is an example

'=======Module=========
Public Declare Function SetTimer& Lib "user32" (ByVal hwnd&, ByVal nIDEvent&, ByVal uElapse&, ByVal lpTimerFunc&)
Public Declare Function KillTimer& Lib "user32" (ByVal hwnd&, ByVal nIDEvent&)

Public Const MY_TIMER_MSG As Long = &H5000& 'Any value, but try to avoid standard qindows MSG values
Dim m_hWnd As Long

Public Sub TimerProc(ByVal hwnd&, ByVal uMsg&, ByVal idEvent&, ByVal dwTime&)
    'Your staff here (like in Timer1_Timer)
    'Even Call MyForm.Timer1_Timer
End Sub

Public Sub EnableTimer(Optional ByVal hwnd as Long, Optional ByVal TimerInterval As Long = 1000) 'TimerInterval in millisec
    m_hWnd=hWnd
    SetTimer hWnd, MY_TIMER_MSG, TimerInterval, AddressOf TimerProc
End Sub

Public Sub DisableTimer()
   KillTimer m_hWnd, MY_TIMER_MSG
End Sub

'Now just call
EnableTimer Me.hWnd, 500
'From your form
'Important! Don't forget to disable timer in Form_Unload event!
0
 

Author Comment

by:lee88
ID: 17827292
excellent. Thanks.
0
 
LVL 28

Expert Comment

by:Ark
ID: 17827302
Thanks for points, glad I could help you.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question