Si si, a parte il problema del tempo :-) ora mi accorgo che la seconda volta non mi richiama la funzione.
Apro un form dove ho messo nel Form_load timer1.enabled=true in modo che comincia a contare, poi la funzione timer è:
codice:
Public Sub Timer1_Timer()
Static tempo As Integer
If tempo = 0 Then
Call ProcessCapInfo
Me.Hide
tempo = tempo + 1
ElseIf tempo = 10 Then
tempo = 0
Call ProcessCapInfo
magbox "entrato"
Me.Hide
Else
tempo = tempo + 1
Exit Sub
End If
la ProcessCapInfo viene chiamata solo la prima volta(cioè quando tempo = 0) mentre quando tempo = 10 viene visualizzata solo la msgbox
senza che si avvii la ProcessCapInfo.
codice:
Public Sub ProcessCapInfo()
With CapParams
' // set the defaults we won't bother the user with
' show message after pre-roll
.fMakeUserHitOKToCapture = -(True) ' - converts VB Boolean to C BOOL
' in case we use error callbacks later
.wPercentDropForError = 10
' fUsingDOSMemory is obsolete
.fUsingDOSMemory = False
' The number of video buffers should be enough to get through
' disk seeks and thermal recalibrations
.wNumVideoRequested = 32
' Do abort on the left mouse
.fAbortLeftMouse = -(True)
' Do abort on the right mouse
.fAbortRightMouse = -(True) '- converts VB boolean to C BOOL
' If wChunkGranularity is zero, the granularity will be set to the
' disk sector size.
.wChunkGranularity = 0
' use default
.dwAudioBufferSize = 0
' attempt to disable caching
.fDisableWriteCache = -(True)
' not using MCI
.fMCIControl = False
.fStepCaptureAt2x = False
' not multi-threading
.fYield = False
' request audio buffers
.wNumAudioRequested = 4 '10 is max limit
' //these parameters are loaded from registry
If "AUDIO" = Trim$(UCase(GetSetting(App.Title, "preferences", "streammaster", "AUDIO"))) Then
.AVStreamMaster = AVSTREAMMASTER_AUDIO 'use audio clock to synchronize AVI
Else
.AVStreamMaster = AVSTREAMMASTER_NONE
End If
'set index size of AVI file (max frames)
.dwIndexSize = Val(GetSetting(App.Title, "preferences", "maxframes", INDEX_15_MINUTES))
' //Now set the parameters from the UserInput
.dwRequestMicroSecPerFrame = microsSecFromFPS(Val(txtFps.Text))
.fCaptureAudio = -(CBool(chkAudio.Value))
.fLimitEnabled = -(CBool(chkLimit.Value))
.wTimeLimit = Val(txtSec.Text)
End With
'set the new setup info
Call capCaptureSetSetup(frmMain.capwnd, CapParams)
'Kludgy - but...
Me.Tag = True 'this tells main form that OK button was pushed
End Sub
Purtroppo(o per fortuna) questo è un codice che ho trovato in rete e mi rendo sempre più conto di quanto è difficile mettere mano al codice scritto da altri.
Sono disposto anche a mettere l'intero progetto a disposizione se qlc1 volesse aiutarmi.