Results 1 to 10 of 10

Thread: [VB6] - instances privates

Threaded View

  1. #10

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,966

    Re: [VB6] - instances privates

    Quote Originally Posted by LaVolpe View Post
    I doubt it. That API basically tests the message queue. Without breaking up your loop with a DoEvents, no other code will be allowed to run while your code is looping. In order to allow other instances of your control to enter their own loops & run their own code, DoEvents (or something similar) is probably the answer. Any code that is executing has nothing to do directly with the message queue. Of course a message may be processed by the queue that activates code (timer for example) or your code may insert messages into the queue (PostMessage for example).
    stills working 1 timer at a time
    Code:
    Private Sub WaitMs(ByVal lngMS As Long) 'wait a given number of milliseconds
        Dim t As Currency
        Dim f As Currency
        Dim e As Currency
        
        Do
            f = 0
            t = 0
            e = 0
            QueryPerformanceFrequency f   'get number of counts/second
            t = f * lngMS / 1000# 'multiply f by number of seconds to get number of counts to wait
            QueryPerformanceCounter e  'get current count number
            e = e + t  'add number of counts to wait to current count
            Do
                QueryPerformanceCounter t
                If t > e Then
                    RaiseEvent Timer
                    If blnEnabled = False Then
                        Exit Sub
                    End If
                    Exit Do
               End If
               DoEvents
            Loop
            If blnEnabled = False Then
                Exit Do
            End If
        Loop
    End Sub
    instead use the do_events can i use 1 api function for tell the program for work with next "work"\process\event?
    Last edited by joaquim; Sep 28th, 2011 at 02:18 PM.
    VB6 2D Sprite control

    To live is difficult, but we do it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width