Function SekunderIAlt(Sekunder_Der_er_gaaet As Long, Procent_Faerdig As Integer) As Long SekunderIAlt = (Sekunder_Der_er_gaaet % Procent_Faerdig) * 100 End Function
terry> jeg bruger AddressOf, nStatus er i % MIN=0 MAX=100.
Public Function StartEncoding(IndWavFile As String, OutMp3File As String) As Long Stop_Encoding = 0 StartEncoding = EncodeMp3(IndWavFile, OutMp3File, AddressOf EnumEncoding) End Function
Public Function EnumEncoding(ByVal nStatus As Integer) As Boolean frmMain.Caption = \"\" & nStatus & \" %\" DoEvents If Stop_Encoding = 1 Then EnumEncoding = False Else EnumEncoding = True End If End Function
sjh> I am going to have to say that I dont know what these functions (EncodeMp3 and EnumEncoding)do, so its difficult to make any suggestions!
I can see that EnumEncoding displays a % and it looks to me as though the function EncodeMp3 uses EnumEncoding for something. But I would need a bit more information before I can help!
I cant see how its possible to change a % to a time without knowing how long its going to take. I suppose its possible to calcule the time taken between each % adjusting underway. Is this what you want? Th eproblem here is that the DLL could have a delay and you can only re-calculate when your return from the DLL call.
Så, nu fik jeg det til at funke. i kan selv prøve. :-)
\'---------------------------- Form1 ---------------------------- Dim TestCount As Long Dim StartTime As Variant
Function TimeStart() StartTime = Timer End Function
Private Function SecToTime(Sec) As String Dim Min As Variant Min = Format(Fix(Sec / 60), \"00\") SecToTime = Format(Fix(Min / 60), \"00\") & \":\" & Format(Min Mod 60, \"00\") & \":\" & Format(Sec Mod 60, \"00\") End Function
Function TimeProcent(CountValue As Variant, MaxValue As Variant) As String Dim t_ProcentTime As Variant Dim t_Time As Variant If CountValue > 0 Then t_Time = CountValue / (Timer - StartTime) t_ProcentTime = (MaxValue - CountValue) / t_Time TimeProcent = SecToTime(t_ProcentTime) End If End Function
Private Sub Command1_Click() \'Start Test TestCount = 0 TimeStart Timer1.Enabled = True End Sub
Private Sub Form_Load() Timer1.Enabled = False Timer1.Interval = 750 End Sub
Private Sub Timer1_Timer() TestCount = TestCount + 1 Me.Caption = TimeProcent(TestCount, 100) & \" - \" & TestCount & \" %\" If TestCount = 100 Then Timer1.Enabled = False End Sub \'---------------------------- Form1 ----------------------------
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.