' Déclarations API
Public Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hWnd As Long) As Long
Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Public Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long
' Renvoie le titre de la fenêtre
Public Function GetWindowCaption(ByVal hWnd As Long) As String
Dim Length As Long
' On récupère la longueur de la chaine et on formate une chaine à cette longueur
Length = GetWindowTextLength(hWnd)
GetWindowCaption = Space$(Length + 1)
' On récupère le nom de la fenetre
Length = GetWindowText(hWnd, GetWindowCaption, Length + 1)
GetWindowCaption = Left$(GetWindowCaption, Len(GetWindowCaption) - 1)
End Function
' Modifie le titre de la fenetre
Public Function SetWindowCaption(ByVal hWnd As Long, ByVal Caption As String)
SetWindowText hWnd, Caption
End Function
03/12/2006 : Petite correction
24/12/2006 : essai
24/12/2006 : ajout de la fonction de modification
Le 30/12/2006 par MadMatt : Petit bug daffichage
Seul les admins et l'auteur du code lui même peuvent modifier ce code.