Private Declare Function GetTickCount Lib "kernel32" () As Long Dim depart As Long Public Function Duree(Total As Long) As String Dim a As String Total = Total / 1000 If ((Total) / 3600) > 1 Then a = Int(Total / 3600) Duree = a & " Heures " & Int((Total / 60) - (a * 60)) & " Mins " & Int((Total) - (a * 3600) - (Int(((Total) / 60) - (a * 60)) * 60)) & " Secs" Else If (Total / 60) > 1 Then a = Int(Total / 60) Duree = a & " Mins " & Int(Total - (a * 60)) & " Secs" Else Duree = Int(Total) & " Secs" End If End If End Function Private Sub Timer1_Timer() Form1.Caption = "Appli ouverte depuis " & Duree(GetTickCount - depart) End Sub Private Sub Form_Load() Timer1.Interval = 1000 depart = GetTickCount End Sub
Coucou!! Bah simpa le code oui ca donne une petit + aussi je travail en Mdi et j'ai beau avoir mit : liste.Status(1).text = "Appli ouverte depuis " & Duree(GetTickCount - depart) >> ici ma form/status/(panel 1) Si tu c pk ca ne marche pas :( ossi g mit ca dans un autre time a true et a 0 Merci sinon c t bien sympa merci de me repondre Angie :)
Ton code pourrais se résumer comme ca : Public Sub TimeFromLaunch(ByRef H, ByRef M, ByRef S) Static Depart As Long: If Depart = 0 Then Depart = Timer Dim InSeconds As Long: InSeconds = Timer - Depart H = Format(InSeconds 3600, "00") M = Format((InSeconds 60) - H * 60, "00") S = Format(InSeconds - 3600 * H - 60 * M, "00") End Sub Private Sub Timer1_Timer() Timer1.Interval = 1000 Dim H As String, M As String, S As String Call TimeFromLaunch(H, M, S) Form1.Caption = "Appli ouverte depuis " & IIf(H <> "00", H & " Heures ", vbNullString) & M & " Min " & S & " Sec" End Sub J'ai modifié la procédure (elle stocke elle même "Départ") et renvoie Heures , Minutes et Secondes, ce qui laisse la liberté d'en faire ce qu'on veux..... Petit truc , Int(Total / 3600) ce dit tout simplement : Total 3600 une division avec le symbole "" est en effet une division entière....
Angie, est-ce que tu as une fenêtre modale, affichée ???
Se souvenir du profil
Mot de passe oublié ? / Activation de compteCréer un compte
1 875 106 membres 16 nouveaux aujourd'hui 16 153 membres club