Hejsan. Kan man köra en procedur i bakgrunden i VB 6 , om det går hur gör man. Problemet är att Hej Skippa det dravlet och använd istället API'et SetTimer. Nedanstående kod är klippt ur en active x controll jag skrev för ngt år sedan för att kolla förändringar i en mapp/katalog .. . OM man lägger sådana här saker i ett formulärs event vet man aldrig riktgt vad och när skaer och ting händer, skapar du en callback med ovanstående kod så har du full kontroll .. Dravel eller inte Jag tackar och bugar för alla tipps. (Jag håller på att testa settimer men den är lite krånglig.) modCallback.basProcedur i bakgrunden 
    
    
jag skall läsa in ~ 25000 poster till en Listwev, men det tar en sådan tid , så jag tänkte om jag lägger in de 100 första posterna när jag öppnar formuläret, och sedan lägger jag in resten när formuläret är laddat och visas på skärmen'
MVH PeterSv: Procedur i bakgrunden 
    
    
Det bör räcka med att du lägger ett DoEvents i loopen
som laddar in.Vidare bör du ha Loopen i Form_Activate.
Och sist men inte minst Omedelbart före Do....
skall du skriva din Listview.Visible = False
och efter Loop.Listview.Visible = True
mvh
SvenSv: Procedur i bakgrunden 
    
    
<code>
'// Callback Module
'// Created: 000705 - Patrik Löwendahl (Resco)
'// Last rev: 000908 - Patrik Löwendahl (Resco)
'// Bugs:
'// Notes:
Option Explicit
'// Callback timer api's
Private Declare Function SetTimer Lib "user32" (ByVal hWnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Private Declare Function KillTimer Lib "user32" (ByVal hWnd As Long, ByVal nIDEvent As Long) As Long
Dim cbID As Long                         '// Callback ID (handle)
Public oNotification As CNotification    '// Local copy of Cnotification
'// Startup
'// Path - ??
'// Waitfor - What to wait for.
'// Timeout - my god..
'// Caller - This refers to who's calling, to be used
'//          for the class so it knows where to raise the event
'// WatchSubDirs - Hmmm wonder where that jolt did go?
Sub StartCallBack(ByVal Path As String, ByVal WaitFor As Long, Timeout As Long, ByRef Caller As DirMonitor, Optional WatchSubDIrs As Boolean = False)
    '// Don't start the timer if already running.
    If cbID = 0 Then
        '// Initiate
        Set oNotification = New CNotification
        '// set caller reciving the event
        Set oNotification.Caller = Caller
        '// start watching, open the kernel object
        oNotification.NotifyFileChange Path, WatchSubDIrs, WaitFor
        '// start callback timer
        cbID = SetTimer(0, 0, Timeout, AddressOf CheckEvent_CBK)
    End If
End Sub
'// shutdown
Sub StopCallback()
    '// Don't stop the timer if it isn't running.
    If cbID Then
        '// safe release of notification and timer object...
        oNotification.Terminate
        Set oNotification = Nothing
        KillTimer 0, cbID
        cbID = 0
    End If
End Sub
'// Changed ??
Sub CheckEvent_CBK(ByVal hWnd As Long, ByVal uMsg As Long, ByVal idEvent As Long, ByVal SysTime As Long)
    '// Look for the event, play it safe to not get any errors
    If Not oNotification Is Nothing Then Call oNotification.WaitForEvent
End Sub
</code>Sv: Procedur i bakgrunden 
    
    Sv: Procedur i bakgrunden 
    
    
MVH PeterSv: Procedur i bakgrunden 
    
    
-
<code>
Option Explicit 
'// Callback timer api's 
Private Declare Function SetTimer Lib "user32" (ByVal hWnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long 
Private Declare Function KillTimer Lib "user32" (ByVal hWnd As Long, ByVal nIDEvent As Long) As Long 
Dim cbID As Long                         '// Callback ID (handle) 
'// Startup 
'// Timeout - my god.. 
Sub StartCallBack(Timeout As Long) 
   '// Don't start the timer if already running. 
   If cbID = 0 Then 
       '// start callback timer 
       cbID = SetTimer(0, 0, Timeout, AddressOf MyBGSub) 
   End If 
End Sub 
'// shutdown 
Sub StopCallback() 
   '// Don't stop the timer if it isn't running. 
   If cbID Then 
       '// safe release of notification and timer object... 
        KillTimer 0, cbID 
       cbID = 0 
   End If 
End Sub 
Sub MyBGSub(ByVal hWnd As Long, ByVal uMsg As Long, ByVal idEvent As Long, ByVal SysTime As Long) 
   Do While Not rs.Eof
      '// Do whatever ... 
      DoEvents      
   Loop
   StopCallBack
End Sub 
</code>
frmMain.frm
-
<code>
Private sub command1_click()
    StartCallBack(1)
end sub
</code>
Borde funka som du vill antar jag