Solved

Timer does not fire during Send operation?

Posted on 2006-10-28
6
216 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
  • 3
  • 2
6 Comments
 
LVL 27

Expert Comment

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

Expert Comment

by:DrDamnit
Comment Utility
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
Comment Utility
Ark: I compiled, but no change. I will try SetTimer API.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 27

Accepted Solution

by:
Ark earned 500 total points
Comment Utility
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
Comment Utility
excellent. Thanks.
0
 
LVL 27

Expert Comment

by:Ark
Comment Utility
Thanks for points, glad I could help you.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

762 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now