?
Solved

Timer does not fire during Send operation?

Posted on 2006-10-28
6
Medium Priority
?
223 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 28

Accepted Solution

by:
Ark earned 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
Suggested Courses
Course of the Month10 days, 12 hours left to enroll

765 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