wander2k.pasdepub@mail.pf
WinME VB6
Bonjours =E0 tous,
D=E9butant(6Mois avec VB6) soyez indulgent MERCI
D=E9sire faire apparaitre le decompte de temps de mon=20
compteur
internet ( fait en VB6 ) dans la barre de titre de la=20
fenetre active
(donc toujours visible). Suis dans le brouillard, comment=20
faire?
Un exemple de code serait le bienvenu Merci d'avance.
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
Zoury
Salut! :O)
: Débutant(6Mois avec VB6) soyez indulgent MERCI
Tu as déjà travaillé avec les APIs? Car ceci peut être complexe, mais c'est la seule solution... :O)
Cet exemple concatène l'heure au texte de la fenêtre présentement active. '*** ' Form1 ' 1 Timer Option Explicit
' Renvoi le handle (numéro d'identification) de la fenêtre ' sur laquelle l'utilsateur travaille présentement Private Declare Function GetForegroundWindow _ Lib "user32" () _ As Long
' Modifie le texte de la fenêtre passé en paramètre Private Declare Function SetWindowText _ Lib "user32" _ Alias "SetWindowTextA" _ ( _ ByVal hWnd As Long, _ ByVal lpString As String _ ) As Long
' Récupère le texte de la fenêtre passée passée en paramètre Private Declare Function GetWindowTextA _ Lib "user32" _ ( _ ByVal hWnd As Long, _ ByVal lpString As String, _ ByVal cch As Long _ ) As Long
Private Sub Timer1_Timer()
Static hOldWnd As Long Static sOldTitle As String Dim hCurrentWnd As Long
' Vérifie si la fenêtre active à changer hCurrentWnd = GetForegroundWindow If (hOldWnd <> hCurrentWnd) Then
' Si oui, on replace le texte ' de l'ancienne fenêtre active ' tel qu'il était au départ If (hOldWnd <> 0) Then Call SetWindowText(hOldWnd, sOldTitle)
' Modifie les variables de traitement hOldWnd = hCurrentWnd sOldTitle = GetWindowText(hCurrentWnd)
End If
' On modifie le texte de la fenêtre ' courante pour y afficher l'heure Call SetWindowText(hCurrentWnd, sOldTitle & " - " & Format$(Now, "hh:nn:ss"))
End Sub
Private Function GetWindowText(ByRef hWnd As Long) As String GetWindowText = String$(255, Chr$(0)) Call GetWindowTextA(hWnd, GetWindowText, 255) GetWindowText = Left$(GetWindowText, InStr(GetWindowText, Chr$(0)) - 1) End Function '***
Merci de poster les réponses au groupe afin d'en faire profiter à tous
Salut! :O)
: Débutant(6Mois avec VB6) soyez indulgent MERCI
Tu as déjà travaillé avec les APIs? Car ceci peut être complexe, mais c'est
la seule solution... :O)
Cet exemple concatène l'heure au texte de la fenêtre présentement active.
'***
' Form1
' 1 Timer
Option Explicit
' Renvoi le handle (numéro d'identification) de la fenêtre
' sur laquelle l'utilsateur travaille présentement
Private Declare Function GetForegroundWindow _
Lib "user32" () _
As Long
' Modifie le texte de la fenêtre passé en paramètre
Private Declare Function SetWindowText _
Lib "user32" _
Alias "SetWindowTextA" _
( _
ByVal hWnd As Long, _
ByVal lpString As String _
) As Long
' Récupère le texte de la fenêtre passée passée en paramètre
Private Declare Function GetWindowTextA _
Lib "user32" _
( _
ByVal hWnd As Long, _
ByVal lpString As String, _
ByVal cch As Long _
) As Long
Private Sub Timer1_Timer()
Static hOldWnd As Long
Static sOldTitle As String
Dim hCurrentWnd As Long
' Vérifie si la fenêtre active à changer
hCurrentWnd = GetForegroundWindow
If (hOldWnd <> hCurrentWnd) Then
' Si oui, on replace le texte
' de l'ancienne fenêtre active
' tel qu'il était au départ
If (hOldWnd <> 0) Then Call SetWindowText(hOldWnd, sOldTitle)
' Modifie les variables de traitement
hOldWnd = hCurrentWnd
sOldTitle = GetWindowText(hCurrentWnd)
End If
' On modifie le texte de la fenêtre
' courante pour y afficher l'heure
Call SetWindowText(hCurrentWnd, sOldTitle & " - " & Format$(Now,
"hh:nn:ss"))
End Sub
Private Function GetWindowText(ByRef hWnd As Long) As String
GetWindowText = String$(255, Chr$(0))
Call GetWindowTextA(hWnd, GetWindowText, 255)
GetWindowText = Left$(GetWindowText, InStr(GetWindowText, Chr$(0)) - 1)
End Function
'***
Tu as déjà travaillé avec les APIs? Car ceci peut être complexe, mais c'est la seule solution... :O)
Cet exemple concatène l'heure au texte de la fenêtre présentement active. '*** ' Form1 ' 1 Timer Option Explicit
' Renvoi le handle (numéro d'identification) de la fenêtre ' sur laquelle l'utilsateur travaille présentement Private Declare Function GetForegroundWindow _ Lib "user32" () _ As Long
' Modifie le texte de la fenêtre passé en paramètre Private Declare Function SetWindowText _ Lib "user32" _ Alias "SetWindowTextA" _ ( _ ByVal hWnd As Long, _ ByVal lpString As String _ ) As Long
' Récupère le texte de la fenêtre passée passée en paramètre Private Declare Function GetWindowTextA _ Lib "user32" _ ( _ ByVal hWnd As Long, _ ByVal lpString As String, _ ByVal cch As Long _ ) As Long
Private Sub Timer1_Timer()
Static hOldWnd As Long Static sOldTitle As String Dim hCurrentWnd As Long
' Vérifie si la fenêtre active à changer hCurrentWnd = GetForegroundWindow If (hOldWnd <> hCurrentWnd) Then
' Si oui, on replace le texte ' de l'ancienne fenêtre active ' tel qu'il était au départ If (hOldWnd <> 0) Then Call SetWindowText(hOldWnd, sOldTitle)
' Modifie les variables de traitement hOldWnd = hCurrentWnd sOldTitle = GetWindowText(hCurrentWnd)
End If
' On modifie le texte de la fenêtre ' courante pour y afficher l'heure Call SetWindowText(hCurrentWnd, sOldTitle & " - " & Format$(Now, "hh:nn:ss"))
End Sub
Private Function GetWindowText(ByRef hWnd As Long) As String GetWindowText = String$(255, Chr$(0)) Call GetWindowTextA(hWnd, GetWindowText, 255) GetWindowText = Left$(GetWindowText, InStr(GetWindowText, Chr$(0)) - 1) End Function '***
Merci de poster les réponses au groupe afin d'en faire profiter à tous
J&B
Pour "Zoury" : Moultes Remerciements ! C'est exactement l' effet recherché. Bien que pratiquant un peu VBA, pour VB6 je suis encore assez ignorant, mais je me soigne. Merci d' avoir bien voulu me répondre. Tout enseignement est bon pour apprendre. (MVP Quézaco ????)
-----Message d'origine----- Salut! :O)
: Débutant(6Mois avec VB6) soyez indulgent MERCI
Tu as déjà travaillé avec les APIs? Car ceci peut être
complexe, mais c'est
la seule solution... :O)
Cet exemple concatène l'heure au texte de la fenêtre
présentement active.
'*** ' Form1 ' 1 Timer Option Explicit
' Renvoi le handle (numéro d'identification) de la fenêtre ' sur laquelle l'utilsateur travaille présentement Private Declare Function GetForegroundWindow _ Lib "user32" () _ As Long
' Modifie le texte de la fenêtre passé en paramètre Private Declare Function SetWindowText _ Lib "user32" _ Alias "SetWindowTextA" _ ( _ ByVal hWnd As Long, _ ByVal lpString As String _ ) As Long
' Récupère le texte de la fenêtre passée passée en
paramètre
Private Declare Function GetWindowTextA _ Lib "user32" _ ( _ ByVal hWnd As Long, _ ByVal lpString As String, _ ByVal cch As Long _ ) As Long
Private Sub Timer1_Timer()
Static hOldWnd As Long Static sOldTitle As String Dim hCurrentWnd As Long
' Vérifie si la fenêtre active à changer hCurrentWnd = GetForegroundWindow If (hOldWnd <> hCurrentWnd) Then
' Si oui, on replace le texte ' de l'ancienne fenêtre active ' tel qu'il était au départ If (hOldWnd <> 0) Then Call SetWindowText
(hOldWnd, sOldTitle)
' Modifie les variables de traitement hOldWnd = hCurrentWnd sOldTitle = GetWindowText(hCurrentWnd)
End If
' On modifie le texte de la fenêtre ' courante pour y afficher l'heure Call SetWindowText(hCurrentWnd, sOldTitle & " - " &
Format$(Now,
"hh:nn:ss"))
End Sub
Private Function GetWindowText(ByRef hWnd As Long) As
Merci de poster les réponses au groupe afin d'en faire
profiter à tous
.
Pour "Zoury" : Moultes Remerciements ! C'est exactement l'
effet recherché.
Bien que pratiquant un peu VBA, pour VB6 je suis encore
assez ignorant,
mais je me soigne. Merci d' avoir bien voulu me répondre.
Tout enseignement est bon pour apprendre.
(MVP Quézaco ????)
-----Message d'origine-----
Salut! :O)
: Débutant(6Mois avec VB6) soyez indulgent MERCI
Tu as déjà travaillé avec les APIs? Car ceci peut être
complexe, mais c'est
la seule solution... :O)
Cet exemple concatène l'heure au texte de la fenêtre
présentement active.
'***
' Form1
' 1 Timer
Option Explicit
' Renvoi le handle (numéro d'identification) de la fenêtre
' sur laquelle l'utilsateur travaille présentement
Private Declare Function GetForegroundWindow _
Lib "user32" () _
As Long
' Modifie le texte de la fenêtre passé en paramètre
Private Declare Function SetWindowText _
Lib "user32" _
Alias "SetWindowTextA" _
( _
ByVal hWnd As Long, _
ByVal lpString As String _
) As Long
' Récupère le texte de la fenêtre passée passée en
paramètre
Private Declare Function GetWindowTextA _
Lib "user32" _
( _
ByVal hWnd As Long, _
ByVal lpString As String, _
ByVal cch As Long _
) As Long
Private Sub Timer1_Timer()
Static hOldWnd As Long
Static sOldTitle As String
Dim hCurrentWnd As Long
' Vérifie si la fenêtre active à changer
hCurrentWnd = GetForegroundWindow
If (hOldWnd <> hCurrentWnd) Then
' Si oui, on replace le texte
' de l'ancienne fenêtre active
' tel qu'il était au départ
If (hOldWnd <> 0) Then Call SetWindowText
(hOldWnd, sOldTitle)
' Modifie les variables de traitement
hOldWnd = hCurrentWnd
sOldTitle = GetWindowText(hCurrentWnd)
End If
' On modifie le texte de la fenêtre
' courante pour y afficher l'heure
Call SetWindowText(hCurrentWnd, sOldTitle & " - " &
Format$(Now,
"hh:nn:ss"))
End Sub
Private Function GetWindowText(ByRef hWnd As Long) As
Pour "Zoury" : Moultes Remerciements ! C'est exactement l' effet recherché. Bien que pratiquant un peu VBA, pour VB6 je suis encore assez ignorant, mais je me soigne. Merci d' avoir bien voulu me répondre. Tout enseignement est bon pour apprendre. (MVP Quézaco ????)
-----Message d'origine----- Salut! :O)
: Débutant(6Mois avec VB6) soyez indulgent MERCI
Tu as déjà travaillé avec les APIs? Car ceci peut être
complexe, mais c'est
la seule solution... :O)
Cet exemple concatène l'heure au texte de la fenêtre
présentement active.
'*** ' Form1 ' 1 Timer Option Explicit
' Renvoi le handle (numéro d'identification) de la fenêtre ' sur laquelle l'utilsateur travaille présentement Private Declare Function GetForegroundWindow _ Lib "user32" () _ As Long
' Modifie le texte de la fenêtre passé en paramètre Private Declare Function SetWindowText _ Lib "user32" _ Alias "SetWindowTextA" _ ( _ ByVal hWnd As Long, _ ByVal lpString As String _ ) As Long
' Récupère le texte de la fenêtre passée passée en
paramètre
Private Declare Function GetWindowTextA _ Lib "user32" _ ( _ ByVal hWnd As Long, _ ByVal lpString As String, _ ByVal cch As Long _ ) As Long
Private Sub Timer1_Timer()
Static hOldWnd As Long Static sOldTitle As String Dim hCurrentWnd As Long
' Vérifie si la fenêtre active à changer hCurrentWnd = GetForegroundWindow If (hOldWnd <> hCurrentWnd) Then
' Si oui, on replace le texte ' de l'ancienne fenêtre active ' tel qu'il était au départ If (hOldWnd <> 0) Then Call SetWindowText
(hOldWnd, sOldTitle)
' Modifie les variables de traitement hOldWnd = hCurrentWnd sOldTitle = GetWindowText(hCurrentWnd)
End If
' On modifie le texte de la fenêtre ' courante pour y afficher l'heure Call SetWindowText(hCurrentWnd, sOldTitle & " - " &
Format$(Now,
"hh:nn:ss"))
End Sub
Private Function GetWindowText(ByRef hWnd As Long) As