1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
| Private Declare Function SendMessage& Lib "user32" Alias "SendMessageA" ( _
ByVal Hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any)
Private Declare Function FindWindow& Lib "user32" Alias "FindWindowA" ( _
ByVal lpClassName As String, ByVal lpWindowName As String)
Private Declare Function SetTimer& Lib "user32" ( _
ByVal Hwnd As Long, ByVal nIDEvent As Long, _
ByVal uElapse As Long, ByVal lpTimerFunc As Long)
Private Declare Function KillTimer& Lib "user32" ( _
ByVal Hwnd As Long, ByVal nIDEvent As Long)
Dim OnTimer&
'___________________________
Private Sub ChangeTitreFenetre()
Const WM_SETTEXT As Long = &HC
Dim Hwnd&
'--- Cas espagnol ---
Hwnd& = FindWindow(vbNullString, "Formato de celda") 'adapter avec le titre exact de la fenêtre recherchée
'--- Sinon en français ---
If Hwnd& = 0 Then Hwnd& = FindWindow(vbNullString, "Format de cellule") 'adapter avec le titre exact de la fenêtre recherchée
'--- on peut poursuivre avec d'autres langues ---
'If Hwnd& = 0 Then Hwnd& = FindWindow(vbNullString, "Titre en zimbabwéen (que je ne connais pas)")
'/// si le titre exact de la fenêtre est trouvé, on le modifie ///
If Hwnd& <> 0 Then SendMessage Hwnd&, WM_SETTEXT, 0, ByVal "ZAZA" 'Nouveau titre (ByVal est impérativement requis)
End Sub
'___________________________
Private Sub RunTimer(Delai&)
If OnTimer& > 0 Then OffTimer
OnTimer& = SetTimer(0, 0, ByVal Delai&, AddressOf ChangeTitreFenetre)
End Sub
'___________________________
Private Sub OffTimer()
If OnTimer& > 0 Then
OnTimer& = KillTimer(0&, OnTimer&)
OnTimer& = 0
End If
End Sub
'___________________________
Sub MonTraitement()
'--- traitement avant ---
'### Appel de la boîte de dialogue ###
RunTimer 0
Application.Dialogs(xlDialogPatterns).Show
OffTimer
'###
'--- Suite traitement ---
End Sub |
Partager