begin process at 2012 02 17 02:40:41
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

Exécution

 > AFFICHAGE, DANS LA BARRE DE TITRE, DE LA DURÉE D'EXECUTER DEE L'APPLICATION

AFFICHAGE, DANS LA BARRE DE TITRE, DE LA DURÉE D'EXECUTER DEE L'APPLICATION


 Information sur la source

 Description

Ce code permet d'afficher la durée depuis laquelle l'application est ouverte.

Ce code est ridicule mais apporte une petite vie a vos appli ;)

ajouter juste un Timer et F5.

Source

  • 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
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



 Sources du même auteur

Source avec Zip Source avec une capture NET SEND + ENREGISTREMENT DANS BASE DE REGISTRE
EXECUTION D'UNE MACRO EN FONCTION DE LA TOUCHE SÉLECTIONNÉE
Source avec Zip AFFICHAGE SUR LA FEUILLE DE LA POSITION DE LA SOUIS

 Sources de la même categorie

Source avec Zip CALCULATRICE par TPB
Source avec Zip Source .NET (Dotnet) PIERRE PAPIER CISEAUX par Ultrabytes
Source avec Zip Source avec une capture UN PATCH EN VB (V3) par PhoenixBytes
Source avec Zip Source .NET (Dotnet) [VB.NET 2008] EXECUTION MULTITHREAD DE PLUSIEURS FONCTION À ... par ShadowTzu
Source avec Zip Source avec une capture MULTITHREADING ACTIVEX par Philippe734

Commentaires et avis

Commentaire de AngelWide92 le 11/12/2003 19:42:52

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 :)

Commentaire de Renfield le 11/12/2003 21:34:45 administrateur CS

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....

Commentaire de Renfield le 11/12/2003 21:38:40 administrateur CS

Angie, est-ce que tu as une fenêtre modale, affichée ???

 Ajouter un commentaire




Nos sponsors


Sondage...

Comparez les prix

CalendriCode

Février 2012
LMMJVSD
  12345
6789101112
13141516171819
20212223242526
272829    

Consulter la suite du CalendriCode

 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 1,888 sec (3)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales