'*****************************************************************************************************
' ___ _ _______ __ _ ____ _ _ _______ ___ _ _ _ ___ _ _.
' // \\ /\\ // // \\ // // // // // // \\ // // // // \\ //| //
' //___// //__\ // //__// // // //__// // // // // // // // // // | //
' // // \\ // // \\ // // // \\ // // // // // // // // // | //
'// // // // // // // //___ // \\ // \\__// //__// //___ \\__// // |//
'****************************************************************************************************
'extrait du module Arrange Userform de 2019
'
'liste des style
'&H94C80080 'Normal à l'origine (juste le bouton fermer)
'&H94CA0080 'seulement le bouton reduire
'&H94C90080 'seulement le bouton agrandir
'&H94CB0080 'seulement les deux boutons agrandir & reduire
'&H94CC0080 'seulement l'elasticité
'&H94CE0080 'seulement l bouton reduire et l'élasticité
'&H94CD0080 'seulement le bouton agranfir et l'élasticité
'&H94C00080 'pas de bouton dans la barre de titre
'&H94080080 'pas de cadre pas de barre de titre
'&H140F0101 'pas de barre de titre mais le cadre et elasticié
'&H1010080 'barre de titre et cadre facon Old Windows
'&H400100 'bouton et titre inversé avec le gwstyle(-20)
'&H94CF0080'La totale
#If VBA7 Then
Declare PtrSafe Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As LongPtr
#If Win64 Then
Declare PtrSafe Function GetWindowLong Lib "user32" Alias "GetWindowLongPtrA" (ByVal HwnD As LongPtr, ByVal nIndex As Long) As LongPtr
Declare PtrSafe Function SetWindowLong Lib "user32" Alias "SetWindowLongPtrA" (ByVal HwnD As LongPtr, ByVal nIndex As Long, ByVal dwNewLong As LongPtr) As LongPtr
#Else
Declare PtrSafe Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal HwnD As LongPtr, ByVal nIndex As Long) As LongPtr
Declare PtrSafe Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal HwnD As LongPtr, ByVal nIndex As Long, ByVal dwNewLong As LongPtr) As LongPtr
#End If
Dim HwnD As LongPtr
#Else
Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal HwnD As Long, ByVal nIndex As Long) As Long
Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal HwnD As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Dim HwnD As Long
#End If
Function IsSystemMenuModified(usf) As Boolean
HwnD = FindWindow(vbNullString, usf.Caption)
IsSystemMenuModified = GetWindowLong(HwnD, -16) <> &H94C80080
End Function
Sub SystemMenuArrange(usf, NewLong)
HwnD = FindWindow(vbNullString, usf.Caption)
SetWindowLong HwnD, -16, NewLong
End Sub