Option Explicit
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function GetWindowLongA Lib "user32" (ByVal hwnd As Long, ByVal NIndex As Long) As Long
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal NIndex As Long, ByVal dwNewLong As Long) As Long
Public Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Public Declare Function GetSystemMetrics Lib "user32" (ByVal NIndex As Long) As Long
Const GWL_STYLE = (-16), GWL_EXSTYLE = (-20), WS_SIZEBOX = &H40000, WS_TROIS_BOUTON = &H70000, WS_EX_APPWINDOW = &H40000
Public L(), h(), f(), p(), s() As String, wLong As Long, hwnd As Long, i, c As Control, la As Long, ha As Long
Public User As Object
Sub InitUSF(Optional Arg_Fictif As Boolean)
i = 0
ha = User.Height
la = User.Width
For Each Ctrl In User.Controls
i = i + 1
ReDim Preserve L(i): L(i) = Ctrl.Width
ReDim Preserve h(i): h(i) = Ctrl.Height
ReDim Preserve p(i): p(i) = Ctrl.Top
ReDim Preserve f(i): f(i) = Ctrl.Left
If TypeName(Ctrl) <> "Image" Then ReDim Preserve s(i): s(i) = Ctrl.Width / Ctrl.Font.Size
Next
hwnd = FindWindow(vbNullString, User.Caption)
wLong = GetWindowLongA(hwnd, GWL_STYLE) Or WS_SIZEBOX Or WS_TROIS_BOUTON
SetWindowLong hwnd, GWL_STYLE, wLong
End Sub
Sub ResizeUSF(Optional Arg_Fictif As Boolean)
On Error Resume Next
i = 0
For Each Ctrl In User.Controls
i = i + 1
Ctrl.Width = User.Width / (la / L(i))
Ctrl.Height = User.Height / (ha / h(i))
If f(i) <> 0 Then Ctrl.Left = User.Width / (la / f(i))
If p(i) <> 0 Then Ctrl.Top = User.Height / (ha / p(i))
'If TypeName(Ctrl) <> "Image" Then ctrl.Font.Size = Ctrl.Width / S(i)
Next
End Sub
Sub AutoResize(Optional Arg_Fictif As Boolean)
If GetSystemMetrics(0) < 1280 Or GetSystemMetrics(1) < 1024 Then ShowWindow hwnd, 3
End Sub