hi Paul,
Option Explicit
Const FichierIco As String = "Logo.ico"
Private Declare Function FindWindowA Lib "user32" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetClassLongA Lib "user32" _
(ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetClassLongA Lib "user32" _
(ByVal hWnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Private Declare Function LoadImageA Lib "user32" _
(ByVal hInst As Long, ByVal lpsz As String, ByVal un1 As Long, _
ByVal n1 As Long, ByVal n2 As Long, ByVal un2 As Long) As Long
Dim HIcon As Long, hWnd As Long
Sub Restore_Ico()
If HIcon Then SetClassLongA hWnd, -14, HIcon
End Sub
Sub Modify_Ico()
Dim FIcone As String
' Adapt the file path
FIcone = "C:\Documents and Settings\Administrateur\Mes documents\alarme.ico"
If Dir$(FIcone) <> "" Then
hWnd = FindWindowA(vbNullString, Application.Caption)
HIcon = GetClassLongA(hWnd, -14)
SetClassLongA hWnd, -14, LoadImageA(0, FIcone, 1, 0, 0, &H10)
End If
End Sub