'*********************************************
'USERFORM REDUIT DANS LA BARRE DES TACHES
'BY patricktoulon
Option Explicit
'API functions
#If VBA7 Then
#If Win64 Then
Private Declare PtrSafe Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As LongPtr, ByVal nIndex As Long) As LongPtr
Private Declare PtrSafe Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As LongPtr, ByVal nIndex As Long, ByVal dwNewLong As LongPtr) As LongPtr
Private Declare PtrSafe Function SetWindowPos Lib "user32" (ByVal hWnd As LongPtr, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Declare PtrSafe Function GetActiveWindow Lib "user32.dll" () As LongPtr
Dim HwnDuSF As LongPtr
#Else
Private Declare PtrSafe Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare PtrSafe Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare PtrSafe Function SetWindowPos Lib "user32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Declare PtrSafe Function GetActiveWindow Lib "user32.dll" () As Long
Dim HwnDuSF&
#End If
#Else
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetWindowPos Lib "user32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Declare Function GetActiveWindow Lib "user32.dll" () As Long
Dim HwnDuSF&
#End If
Private Sub UserForm_Activate()
trois_boutons
ajout_dans_la_taskList Me
End Sub
'on ajoute les boutons minimiser et maximiser à l'userform
Private Sub trois_boutons()
HwnDuSF& = GetActiveWindow
SetWindowLong HwnDuSF&, -16, &H94C80080 Or &H94CF8080
SetWindowPos HwnDuSF&, 0, 0, 0, 0, 0, &H20 Or &H2 Or &H1
End Sub
Private Sub ajout_dans_la_taskList(myForm)
SetWindowPos HwnDuSF&, 0, 0, 0, 0, 0, &H2 Or &H1 Or &H10 Or &H80
SetWindowLong HwnDuSF&, -20, &H101 Or &H40101
SetWindowPos HwnDuSF&, 0, 0, 0, 0, 0, &H2 Or &H1 Or &H10 Or &H40
End Sub