CONNAITRE LA FENTRE ACTIVE WINDOWS QUI A LE FOCUS

Résolu
noussaDardouri Messages postés 16 Date d'inscription jeudi 18 mars 2010 Statut Membre Dernière intervention 10 janvier 2011 - 5 janv. 2011 à 16:27
cs_Exploreur Messages postés 4821 Date d'inscription lundi 11 novembre 2002 Statut Membre Dernière intervention 15 novembre 2016 - 7 janv. 2011 à 14:56
Salut,
je veux écrire un programme vb6 pour afficher le nom de fenêtre qui à la focus le code qui j'utilise est la suivant :

Public Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Private Declare Function GetWindowText Lib "user32" Alias GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long

Private Declare Function GetForegroundWindow Lib "user32" () As Long

Public Function GetActiveWindowApp() As String
Dim hWndlength As Long, hWndTitle As String, returnvalue As Long
Dim hwnd As Long
hwnd = GetForegroundWindow
hWndlength = GetWindowTextLength(hwnd)
hWndTitle = String$(hWndlength, 0)
returnvalue = GetWindowText(hwnd, hWndTitle, (hWndlength + 1))
GetActiveWindowApp = hWndTitle
End Function

Private Sub Form_Load()
MsgBox GetActiveWindowApp()
End Sub
Mais lorsqu'on le focus sur un page web n'affiche aucun resultat.
Merci de m'aider.

2 réponses

noussaDardouri Messages postés 16 Date d'inscription jeudi 18 mars 2010 Statut Membre Dernière intervention 10 janvier 2011
6 janv. 2011 à 09:35
Salut,
Finalement j'utilise le timer pour afficher le nom de fenetre qui à la focus .Ce programme ça marche
3
cs_Exploreur Messages postés 4821 Date d'inscription lundi 11 novembre 2002 Statut Membre Dernière intervention 15 novembre 2016 15
7 janv. 2011 à 14:56
Un timer ? Je me demande s'il n'y a pas une API qui pourrais faire cela....?

++ Exploreur Linux a un noyau, Windows un pépin     ** http://www.The-West.fr Alias : Exploreur **
0
Rejoignez-nous